#async #redis #pool

deadpool-redis

Dead simple async pool for redis

7 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

0.5.2 Feb 4, 2020
0.5.1 Jan 18, 2020
0.4.1 Dec 31, 2019
0.3.0 Dec 13, 2019
0.2.0 Dec 3, 2019

#118 in Asynchronous

Download history 126/week @ 2020-02-06 148/week @ 2020-02-13 109/week @ 2020-02-20 93/week @ 2020-02-27 89/week @ 2020-03-05 98/week @ 2020-03-12 171/week @ 2020-03-19 122/week @ 2020-03-26 78/week @ 2020-04-02 121/week @ 2020-04-09 82/week @ 2020-04-16 126/week @ 2020-04-23 183/week @ 2020-04-30 104/week @ 2020-05-07 82/week @ 2020-05-14 79/week @ 2020-05-21

468 downloads per month
Used in admino

MIT/Apache

57KB
844 lines

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.

Dependencies

~7.5MB
~155K SLoC