poolx-redis 0.1.2

poolx for redis, with many features like idle connection checking and reaping, healthcheck, and more.
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 29.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.43 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 9s Average build duration of successful builds.
  • all releases: 1m 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • arthur-zhang/poolx
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • arthur-zhang

Poolx is a generic connection pool implementation for Rust, Its original code is from sqlx, and I have made many changes to make it more generic and remove lots of useless code.

features

  • test on borrow
  • idle connection with timeout check
  • customize close/ping method implementation
  • lazy connection

example usage

#[tokio::main]
async fn main() {
    let url = "redis://:foobared@127.0.0.1:6379";
    let option = url.parse::<RedisConnectionOption>().unwrap();

    let pool: Pool<RedisConnection> = PoolOptions::new()
        .test_before_acquire(true)
        .idle_timeout(std::time::Duration::from_secs(3))
        .min_connections(3)
        .max_connections(100)
        .connect_lazy_with(option);

    for i in 0..10 {
        let mut conn = pool.acquire().await.unwrap();
        let reply: String = cmd("PING").query_async(conn.as_mut()).await.unwrap();
        println!("reply: {}", reply);
    }
}