pyredlock - A Redis distributed lock implementation in Python
This python lib implements the Redis-based distributed lock manager algorithm described in this blog post.
How to use it?
To create a lock manager:
from pyredlock import RedisClient
from pyredlock import Redlock, Lock
...
client = RedisClient(client_conf={
"endpoint": "localhost:6379",
"password": "your_redis_password",
"db": 0,
"socket_timeout": 0.5,
"socket_connect_timeout": 0.25
})
lock_mgr = Redlock(connections=[client.get_connection()], async_mode=False)
...
To acquire a lock:
...
success, my_lock = lock_mgr.lock("my_resource_name", 1000)
...
To release a lock:
...
lock_mgr.unlock(my_lock)
...
To extend your ownership of a lock that you already own:
...
lock_mgr.extend(my_lock, 1000)
...
Disclaimer: This implementation is currently a proposal, it was not formally analyzed. Make sure to understand how it works before using it in your production environments.
Metadata
Release files for pyredlock 1.0.0
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 |
|---|---|---|---|---|
| pyredlock-1.0.0.tar.gz | 9.3 kB | Without provenance | Details for pyredlock-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyredlock-1.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pyredlock-1.0.0-py2.py3-none-any.whl |
Total release size: 19.4 kB
Release files / pyredlock-1.0.0.tar.gz
| Download URL | pyredlock-1.0.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89e6255f4cadd4f2288e177415adbb07147aec971a36d5ef3c516c3923c047b3
|
|
BLAKE2b-256 checksum How to use checksums |
31679a227e4ade8acf07c87c5ef028acfd75e7fa20bc9d87fa1a6638f4356cba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Release files / pyredlock-1.0.0-py2.py3-none-any.whl
| Download URL | pyredlock-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5642227d97d9d8a8c0adb598662ea867e9dd64f49ac5c7aef709d554e436363d
|
|
BLAKE2b-256 checksum How to use checksums |
6c23826dac893e6942456ff1480ed4d5da6b1da4a6d119116ea562b3ef6ce969
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.16
|
Security for pyredlock 1.0.0
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.