Skip to main content

基于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

  • 版本首发。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redis-fair-semaphore-0.1.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

redis_fair_semaphore-0.1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file redis-fair-semaphore-0.1.0.tar.gz.

File metadata

  • Download URL: redis-fair-semaphore-0.1.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for redis-fair-semaphore-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93d83e371bf83e5f82a7953677b2826f0ce9c4a1a46add13cd42bf342e0d9e17
MD5 842ea726375add76b54ad73c3f61702d
BLAKE2b-256 85f38cbf7f1f8fc8adf97c23562000711444415ae7b5b5f77affec193e13c7ad

See more details on using hashes here.

File details

Details for the file redis_fair_semaphore-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for redis_fair_semaphore-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f50ce5091bc18fb3888638715fe639a926b2b3ce565aed3c125b28ffe770d50
MD5 16e0db422fde90af28d83a11600892ef
BLAKE2b-256 5422f8a86c333956409574ac627ceb918547ef9e90867504b7ad679f58d452fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page