Skip to main content

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.

Release files for redis-fair-semaphore 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redis-fair-semaphore 0.1.1
File Size Uploaded
redis_fair_semaphore-0.1.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redis-fair-semaphore 0.1.1
File Interpreter ABI Platform
redis_fair_semaphore-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.0 kB

Release files / redis_fair_semaphore-0.1.1.tar.gz

Download URL redis_fair_semaphore-0.1.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1222bd806cb97e48f0b059dbeb676e428d5f82e0a9bf6a564b065085cc25f5d2
BLAKE2b-256 checksum
How to use checksums
cddd04b02674aae2901169e37d1ce331ef740f994387815e04ce6b4603104ad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release files / redis_fair_semaphore-0.1.1-py3-none-any.whl

Download URL redis_fair_semaphore-0.1.1-py3-none-any.whl
Size 2.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76c30effc6809fa2f1d115b16355867919e9b048df9bdc750576cf7d562f7f74
BLAKE2b-256 checksum
How to use checksums
b187690ae36e77b8d0d7816010e4aa3793a60407393e6b076a95c1784472e5c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page