Socket
Book a DemoInstallSign in
Socket

redis-fair-semaphore

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-fair-semaphore

基于Redis的信号量。

pipPyPI
Version
0.1.1
Maintainers
1

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.

Keywords

fair semaphore

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts