Пример #1
0
def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool

    connection_pool = pool.get_connection_pool(parser_class=redis.connection.HiredisParser, **settings.REDIS)
    return redis.Redis(connection_pool=connection_pool, **settings.REDIS)
Пример #2
0
def get_redis_connection():
    """
    Helper used for obtain a raw redis client.
    """
    from redis_cache.cache import pool
    client = redis.Redis(**settings.REDIS)
    client.connection_pool = pool.get_connection_pool(
        client,
        parser_class=redis.connection.HiredisParser,
        connection_pool_class=redis.ConnectionPool,
        connection_pool_class_kwargs={},
        **settings.REDIS)
    return client