from kedong.settings import CONFIG
import redis



class RedisPool():

    def __init__(self):
        self.redis_host = CONFIG["redis"]['ip']
        self.redis_port = CONFIG["redis"]['port']
        self.redis_password = CONFIG["redis"]['password']

    def get_redis_pool(self, db):
        rk = redis.ConnectionPool(
            host=self.redis_host,
            port=self.redis_port,
            password=self.redis_password,
            db=db,
            decode_responses=True
        )
        return redis.StrictRedis(connection_pool=rk)
