redis_lock¶
-
class
redis_lock.
Lock
(redis_client, name, expire=None, id=None, auto_renewal=False, strict=True, signal_expire=1000)[source]¶ A Lock context manager implemented via redis SETNX/BLPOP.
-
acquire
(blocking=True, timeout=None)[source]¶ Parameters: - blocking – Boolean value specifying whether lock should be blocking or not.
- timeout – An integer value specifying the maximum number of seconds to block.
-
extend
(expire=None)[source]¶ Extends expiration time of the lock.
Parameters: expire – New expiration time. If None
- expire provided during lock initialization will be taken.
-
locked
()[source]¶ Return true if the lock is acquired.
Checks that lock with same name already exists. This method returns true, even if lock have another id.
-