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)
"""
:param expire: lock key ttl(ms)
:param retry_times: retry times to get lock
:param retry_interval: retry interval(ms)
"""
with RedLock(rds, 'key-name', expires=30000, retry_times=3, retry_interval=50) 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
Metadata
Release files for redlock-dist 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| redlock-dist-1.0.1.tar.gz | 2.1 kB | Without provenance | Details for redlock-dist-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redlock_dist-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for redlock_dist-1.0.1-py3-none-any.whl |
Total release size: 4.7 kB
Release files / redlock-dist-1.0.1.tar.gz
| Download URL | redlock-dist-1.0.1.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d00d3755357aac8e7256fcf9a4de004601b3b0c842cf53ed00ff8b93991d56de
|
|
BLAKE2b-256 checksum How to use checksums |
9c5088d591e2b3c03e41837633acf29a08721eecbcd464e4c56bf0cf5aeebbbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / redlock_dist-1.0.1-py3-none-any.whl
| Download URL | redlock_dist-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
685e3a7b39fbf87415b21596221c21ba9aa78a4d25976fe651facc9e2e52f532
|
|
BLAKE2b-256 checksum How to use checksums |
39795daa7401b8eab0e035943ff8a675fbbdad2356ae23988ea7598242952318
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for redlock-dist 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.