Distributed locks with Redis
Project description
redlock-dist
Implementation of distributed locking with Redis
Usage
Install:
pip install redlock-dist
example:
from redis import StrictRedis
from redlock_dist import RedLock
rds = StrictRedis(host='localhost', port=6379, db=0)
with RedLock(rds, 'key-name') as red_lock:
if red_lock:
print('get lock')
else:
print('do not get lock')
Principle and notes
Because Redis is single-threaded and you can use SET key value NX PX expires
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
redlock-dist-1.0.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for redlock_dist-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97ed250f9e89c04a93862a038aa406e86286b7dc997b8410138266ab8268ae1f |
|
MD5 | a2a13b018207272bbb14be58e5a97556 |
|
BLAKE2b-256 | 63f16504a612c9e1e4f018316c6758e3a128ef70a8134ac410c090be2b02fae9 |