[−][src]Crate deadpool_redis
Deadpool for Redis
Deadpool is a dead simple async pool for connections and objects of any type.
This crate implements a deadpool
manager for redis
.
Features
Feature | Description | Extra dependencies | Default |
---|---|---|---|
config | Enable support for config crate | config , serde/derive | yes |
Example
use deadpool_redis::{cmd, Config}; use redis::FromRedisValue; #[tokio::main] async fn main() { let cfg = Config::from_env("REDIS").unwrap(); let pool = cfg.create_pool().unwrap(); { let mut conn = pool.get().await.unwrap(); cmd("SET") .arg(&["deadpool/test_key", "42"]) .execute_async(&mut conn) .await.unwrap(); } { let mut conn = pool.get().await.unwrap(); let value: String = cmd("GET") .arg(&["deadpool/test_key"]) .query_async(&mut conn) .await.unwrap(); assert_eq!(value, "42".to_string()); } }
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Structs
Cmd | Wrapper for |
Config | Configuration object. By enabling the |
ConnectionWrapper | A type alias for using |
Manager | The manager for creating and recyling lapin connections |
Pipeline | Wrapper for |
Functions
cmd | Shortcut function to creating a command with a single argument. |
pipe | Shortcut for creating a new pipeline. |
Type Definitions
Pool | A type alias for using |
PoolError | A type alias for using |