Redis based distributed lock
This is a simple distributed lock based on redis. It needs asyncio, otherwise it will not work!
You can install it simply with pip install rdlock_py
Usage
1, setup a redis client factory.
2, get a mutex and manage it with the context manager.
from rdlock import RDLockFactory, LockError, LockTimeout
factory = RDLockFactory("redis://:@localhost:30000/0")
try:
async with factory.get_mutex("test_mutex", "my_owner", 1.0):
# do your work here
pass
except LockTimeout:
print("failed to get lock in several seconds...")
except LockError:
print("Something wrong when communicating with redis")
Test
Use the uv run pytest will automatically test all cases.
Metadata
Release files for rdlock_py 0.1.3
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 |
|---|---|---|---|---|
| rdlock_py-0.1.3.tar.gz | 4.1 kB | Without provenance | Details for rdlock_py-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rdlock_py-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for rdlock_py-0.1.3-py3-none-any.whl |
Total release size: 8.8 kB
Release files / rdlock_py-0.1.3.tar.gz
| Download URL | rdlock_py-0.1.3.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86a5a2323b99004001bfc66997e8fd80577632e2cef53f977e1951ca2e10cec9
|
|
BLAKE2b-256 checksum How to use checksums |
7bba5515022d3edf39b1fa9f1a26bede9dd34c365c995bea69db43077803923a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / rdlock_py-0.1.3-py3-none-any.whl
| Download URL | rdlock_py-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a90c5f6b35f89cccc4f69ae7e96d8325506b5c9b894e9a39db84d98c21b7e9cf
|
|
BLAKE2b-256 checksum How to use checksums |
2d12be24b80209b6b86a0d528f8bdb487a059e5b1046b5ae8b99d4fcc07ce9ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for rdlock_py 0.1.3
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.