Public Member Functions | |
def | __enter__ |
def | __exit__ |
def | __init__ |
def | acquire |
def | release |
Public Attributes | |
acquired_until | |
name | |
redis | |
sleep | |
timeout | |
Static Public Attributes | |
tuple | LOCK_FOREVER = float(2 ** 31 + 1) |
A shared, distributed Lock. Using Redis for locking allows the Lock to be shared across processes and/or machines. It's left to the user to resolve deadlock issues and make sure multiple clients play nicely together.
def redis.client.Lock.__init__ | ( | self, | |
redis, | |||
name, | |||
timeout = None , |
|||
sleep = 0.1 |
|||
) |
Create a new Lock instnace named ``name`` using the Redis client supplied by ``redis``. ``timeout`` indicates a maximum life for the lock. By default, it will remain locked until release() is called. ``sleep`` indicates the amount of time to sleep per loop iteration when the lock is in blocking mode and another client is currently holding the lock. Note: If using ``timeout``, you should make sure all the hosts that are running clients have their time synchronized with a network time service like ntp.
def redis.client.Lock.__enter__ | ( | self | ) |
def redis.client.Lock.__exit__ | ( | self, | |
exc_type, | |||
exc_value, | |||
traceback | |||
) |
def redis.client.Lock.acquire | ( | self, | |
blocking = True |
|||
) |
def redis.client.Lock.release | ( | self | ) |
tuple redis::client.Lock::LOCK_FOREVER = float(2 ** 31 + 1) [static] |