基于Redis的信号量。
Project description
redis-fair-semaphore
基于Redis的信号量。
Install
pip install redis-fair-semaphore
使用方法
import redis
from redis_fair_semaphore import acquire_fair_semaphore
from redis_fair_semaphore import release_fair_semaphore
conn = redis.from_url("redis://redis/0")
def test():
sem_id = acquire_fair_semaphore(conn, "test_sem_name", 10)
try:
if sem_id:
print("Acquired...")
else:
print("NOT acquired...")
finally:
release_fair_semaphore(conn, "test_sem_name", sem_id)
if __name__ == "__main__":
test()
版本记录
v0.1.0
- 版本首发。
v0.1.1
- Doc update.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis_fair_semaphore-0.1.1.tar.gz.
File metadata
- Download URL: redis_fair_semaphore-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1222bd806cb97e48f0b059dbeb676e428d5f82e0a9bf6a564b065085cc25f5d2
|
|
| MD5 |
f2cef4e3a0395a510d638e7c617cee03
|
|
| BLAKE2b-256 |
cddd04b02674aae2901169e37d1ce331ef740f994387815e04ce6b4603104ad5
|
File details
Details for the file redis_fair_semaphore-0.1.1-py3-none-any.whl.
File metadata
- Download URL: redis_fair_semaphore-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76c30effc6809fa2f1d115b16355867919e9b048df9bdc750576cf7d562f7f74
|
|
| MD5 |
6b6fff777f912173b3d26093e823ae5e
|
|
| BLAKE2b-256 |
b187690ae36e77b8d0d7816010e4aa3793a60407393e6b076a95c1784472e5c4
|