Python redis.connection.ConnectionPool() Examples

The following are 2 code examples of redis.connection.ConnectionPool(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module redis.connection , or try the search function .
Example #1
Source File: patch_conn.py    From rlite-py with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def patch_connection(filename=':memory:'):
    """
    ``filename``: rlite filename to store db in, or memory
    Patch the redis-py Connection and the
    static from_url() of Redis and StrictRedis to use RliteConnection
    """

    if no_redis:
        raise Exception("redis package not found, please install redis-py via 'pip install redis'")

    RliteConnection.set_file(filename)

    global orig_classes

    # already patched
    if orig_classes:
        return

    orig_classes = (redis.connection.Connection,
                    redis.connection.ConnectionPool)

    _set_classes(RliteConnection, RliteConnectionPool)


# ============================================================================ 
Example #2
Source File: patch_conn.py    From rlite-py with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def _set_classes(conn_class, pool_class):
    redis.connection.Connection = conn_class
    redis.Connection = conn_class

    redis.connection.ConnectionPool = pool_class
    redis.client.ConnectionPool = pool_class
    redis.ConnectionPool = pool_class