foxtive 0.25.6

Foxtive Framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::redis::config::RedisConfig;
use crate::results::AppResult;
use anyhow::Error;
use deadpool_redis::{Manager, Pool};
use redis::Client;

pub fn create_redis_connection(dsn: &str) -> AppResult<Client> {
    Client::open(dsn).map_err(Error::msg)
}

pub fn create_redis_conn_pool(config: RedisConfig) -> AppResult<Pool> {
    let manager = Manager::new(config.dsn)?;

    Pool::builder(manager)
        .config(config.pool_config)
        .build()
        .map_err(Error::msg)
}