/bb8-redis-cluster

Full-featured async (tokio-based) redis cluster connection pool (like r2d2)

Primary LanguageRustBSD 2-Clause "Simplified" LicenseBSD-2-Clause

bb8-redis-cluster

A Async redis cluster connection pool (bb8).

Example

#[tokio::main]
async fn main() {
    let manager = RedisConnectionManager::new(vec!["redis://localhost:1234"]).unwrap();
    let pool = bb8::Pool::builder()
        .max_size(15)
        .build(manager)
        .await
        .unwrap();

    for _ in 0..20 {
        let pool = pool.clone();
        tokio::spawn(async move {
            let mut conn = pool.get().await.unwrap();
            let reply: String = cmd("PING").query_async(&mut *conn).await.unwrap();
            assert_eq!("PONG", reply);
        });
    }
}