Deadpool is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool
manager for redis
.
```rust use std::env;
use deadpool_redis::{Manager, Pool}; use futures::compat::Future01CompatExt; use redis::FromRedisValue;
async fn main() { let mgr = Manager::new("redis://127.0.0.1/").unwrap(); let pool = Pool::new(mgr, 16); { let mut conn = pool.get().await.unwrap(); let mut cmd = redis::cmd("SET"); cmd.arg(&["deadpool/testkey", "42"]); conn.query(&cmd).await.unwrap(); } { let mut conn = pool.get().await.unwrap(); let mut cmd = redis::cmd("GET"); cmd.arg(&["deadpool/testkey"]); let value = conn.query(&cmd).await.unwrap(); asserteq!(String::fromredisvalue(&value).unwrap(), "42".tostring()); } } ```
Licensed under either of
at your option.