pub async fn build_pool() -> anyhow::Result<redis::aio::ConnectionManager> {
    let server = std::env::var("REDIS_HOST").unwrap_or_else(|_| "redis".to_string());
    let port = std::env::var("REDIS_PORT").unwrap_or_else(|_| "6379".to_string());
    let db = std::env::var("REDIS_DB").unwrap_or_else(|_| "0".to_string());
    let username = std::env::var("REDIS_USERNAME").ok();
    let password = std::env::var("REDIS_PASSWORD").ok();
    let addr = ConnectionAddr::Tcp(server, port.parse()?);
    let redis = RedisConnectionInfo {
        db: db.parse()?,
        username,
        password,
    };
    let cinfo = ConnectionInfo { addr, redis };
    let client = redis::Client::open(cinfo)?;
    let o = redis::aio::ConnectionManager::new(client).await?;
    Ok(o)
}
/// creates an async connection to a redis server
creates an async connection to a redis server
creates an async connection to a redis server
pub async fn build_pool() -> anyhow::Result<redis::aio::ConnectionManager> {
    let server = std::env::var("REDIS_HOST").unwrap_or_else(|_| "redis".to_string());
    let port = std::env::var("REDIS_PORT").unwrap_or_else(|_| "6379".to_string());
    let db = std::env::var("REDIS_DB").unwrap_or_else(|_| "0".to_string());
    let username = std::env::var("REDIS_USERNAME").ok();
    let password = std::env::var("REDIS_PASSWORD").ok();
    let addr = ConnectionAddr::Tcp(server, port.parse()?);
    let redis = RedisConnectionInfo {
        db: db.parse()?,
        username,
        password,
    };
    let cinfo = ConnectionInfo { addr, redis };
    let client = redis::Client::open(cinfo)?;
    let o = redis::aio::ConnectionManager::new(client).await?;
    Ok(o)
}
pub async fn build_pool ( ) -> anyhow :: Result < redis :: aio :: ConnectionManager > { let server = std :: env :: var ( " " ) . unwrap_or_else ( | _ | " " . to_string ( ) ) ; let port = std :: env :: var ( " " ) . unwrap_or_else ( | _ | " " . to_string ( ) ) ; let db = std :: env :: var ( " " ) . unwrap_or_else ( | _ | " " . to_string ( ) ) ; let username = std :: env :: var ( " " ) . ok ( ) ; let password = std :: env :: var ( " " ) . ok ( ) ; let addr = ConnectionAddr :: Tcp ( server , port . parse ( ) ? ) ; let redis = RedisConnectionInfo { db : db . parse ( ) ? , username , password , } ; let cinfo = ConnectionInfo { addr , redis } ; let client = redis :: Client :: open ( cinfo ) ? ; let o = redis :: aio :: ConnectionManager :: new ( client ) . await ? ; Ok ( o ) }
creates an async connection to a redis server
creates an async connection to a redis server