bb8-redis-cluster

Crates.iobb8-redis-cluster
lib.rsbb8-redis-cluster
version0.1.1
sourcesrc
created_at2022-10-18 13:14:59.816722
updated_at2023-05-08 14:03:26.530795
descriptionFull-featured async (tokio-based) redis cluster connection pool (like r2d2)
homepage
repositoryhttps://github.com/0xWOF/bb8-redis-cluster
max_upload_size
id690887
size7,075
Subeom Choi (0xWOF)

documentation

README

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);
        });
    }
}
Commit count: 6

cargo fmt