deadpool-redis 0.5.2

Dead simple async pool for redis
Documentation

Deadpool for Redis Latest Version

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

at your option.