|
|
@ -21,11 +21,18 @@ def fix_return_type(func):
|
|
|
|
PATCHED_METHODS = ['_setex', '_lrem', '_zadd', '_pipeline', '_ttl']
|
|
|
|
PATCHED_METHODS = ['_setex', '_lrem', '_zadd', '_pipeline', '_ttl']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _hset(self, key, field_name, value, pipeline=None):
|
|
|
|
|
|
|
|
connection = pipeline if pipeline is not None else self
|
|
|
|
|
|
|
|
connection.hset(key, field_name, value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def patch_connection(connection):
|
|
|
|
def patch_connection(connection):
|
|
|
|
# Don't patch already patches objects
|
|
|
|
# Don't patch already patches objects
|
|
|
|
if all([hasattr(connection, attr) for attr in PATCHED_METHODS]):
|
|
|
|
if all([hasattr(connection, attr) for attr in PATCHED_METHODS]):
|
|
|
|
return connection
|
|
|
|
return connection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connection._hset = partial(_hset, connection)
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(connection, Redis):
|
|
|
|
if isinstance(connection, Redis):
|
|
|
|
connection._setex = partial(StrictRedis.setex, connection)
|
|
|
|
connection._setex = partial(StrictRedis.setex, connection)
|
|
|
|
connection._lrem = partial(StrictRedis.lrem, connection)
|
|
|
|
connection._lrem = partial(StrictRedis.lrem, connection)
|
|
|
|