本文整理汇总了Python中redis.connection.Connection方法的典型用法代码示例。如果您正苦于以下问题:Python connection.Connection方法的具体用法?Python connection.Connection怎么用?Python connection.Connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.connection
的用法示例。
在下文中一共展示了connection.Connection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: patch_connection
# 需要导入模块: from redis import connection [as 别名]
# 或者: from redis.connection import Connection [as 别名]
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)
# ============================================================================
示例2: _set_classes
# 需要导入模块: from redis import connection [as 别名]
# 或者: from redis.connection import Connection [as 别名]
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