Redis cluster support for the r2d2
connection pool.
```rust,norun extern crate r2d2; extern crate r2d2redis_cluster;
use std::thread;
use r2d2::Pool; use r2d2rediscluster::{Commands, RedisClusterConnectionManager};
fn main() { let redisuri = vec!["redis://127.0.0.1:6379", "redis://127.0.0.1:6378", "redis://127.0.0.1:6377"]; let manager = RedisClusterConnectionManager::new(redisuri).unwrap(); let pool = Pool::builder() .build(manager) .unwrap();
let mut handles = Vec::new();
for _ in 0..10 {
let pool = pool.clone();
handles.push(thread::spawn(move || {
let connection = pool.get().unwrap();
let n: u64 = connection.incr("test", 1).unwrap();
}));
}
for h in handles {
h.join().unwrap();
}
let connection = pool.get().unwrap();
let res: u64 = connection.get("test").unwrap();
assert_eq!(res, 10);
} ```