Distributed locks with Redis
Project description
RedLock - Distributed locks with Redis and Python
This library implements the RedLock algorithm introduced by @antirez
The detailed description of the RedLock algorithm can be found in the Redis documentation: Distributed locks with Redis.
The redlock.RedLock class shares a similar API with the threading.Lock class in the Python Standard Library.
Simple Usage
from redlock import RedLock
lock = RedLock("distributed_lock")
lock.acquire()
do_something()
lock.release()
With Statement / Context Manager
As with threading.Lock, redlock.RedLock objects are context managers thus support the With Statement. Thsi way is more pythonic and recommended.
from redlock import RedLock
with RedLock("distributed_lock"):
do_something()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
redlock-0.1.4.tar.gz
(3.6 kB
view hashes)