nxtgauge-backend-rust/crates/cache/src/client.rs

11 lines
371 B
Rust
Raw Normal View History

use redis::aio::ConnectionManager;
/// Thread-safe, auto-reconnecting Redis handle.
/// Clone is cheap — all clones share the same underlying multiplexed connection.
pub type RedisPool = ConnectionManager;
pub async fn connect(url: &str) -> Result<RedisPool, redis::RedisError> {
let client = redis::Client::open(url)?;
ConnectionManager::new(client).await
}