Skip to main content

BoundedSemaphore

A semaphore shared by every thread and process on the cache: at most value holders at once.

Usage

Source

BoundedSemaphore(
    cache,
    key,
    value=1,
    expire=None,
    tag=None,
)

Releasing more than were acquired raises AssertionError.

Methods

Name Description
acquire() Wait for a free slot and take it.
release() Give a slot back.

acquire()

Wait for a free slot and take it.

Usage

Source

acquire()

release()

Give a slot back.

Usage

Source

release()