Skip to main content

Lock

A lock shared by every thread and process on the cache: acquire(), release(), locked(),

Usage

Source

Lock(
    cache,
    key,
    expire=None,
    tag=None,
)

or with lock:. Not reentrant (see RLock); any holder of the key can release it.

acquire() polls every millisecond until it gets the lock. Give it an expire so a holder that dies without releasing doesn’t keep it forever.

Methods

Name Description
acquire() Wait for the lock and take it.
locked() Whether someone holds the lock.
release() Release the lock.

acquire()

Wait for the lock and take it.

Usage

Source

acquire()

locked()

Whether someone holds the lock.

Usage

Source

locked()

release()

Release the lock.

Usage

Source

release()