Crates.io | bb8-redis-cluster |
lib.rs | bb8-redis-cluster |
version | 0.1.1 |
source | src |
created_at | 2022-10-18 13:14:59.816722 |
updated_at | 2023-05-08 14:03:26.530795 |
description | Full-featured async (tokio-based) redis cluster connection pool (like r2d2) |
homepage | |
repository | https://github.com/0xWOF/bb8-redis-cluster |
max_upload_size | |
id | 690887 |
size | 7,075 |
A Async redis cluster connection pool (bb8).
#[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);
});
}
}