[−][src]Crate deadpool_redis
Deadpool simple async pool for AMQP connections.
This crate implements a deadpool
manager for lapin
.
You should not need to use deadpool
directly. Use the Pool
type
provided by this crate instead.
Example
use std::env; use deadpool_redis::{Manager, Pool}; use futures::compat::Future01CompatExt; use redis::FromRedisValue; #[tokio::main] 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/test_key", "42"]); conn.query(&cmd).await.unwrap(); } { let mut conn = pool.get().await.unwrap(); let mut cmd = redis::cmd("GET"); cmd.arg(&["deadpool/test_key"]); let value = conn.query(&cmd).await.unwrap(); assert_eq!(String::from_redis_value(&value).unwrap(), "42".to_string()); } }
Structs
Connection | A type alias for using |
Manager | The manager for creating and recyling lapin connections |
Type Definitions
Pool | A type alias for using |