11 lines
371 B
Rust
11 lines
371 B
Rust
|
|
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
|
||
|
|
}
|