Skip to content

types

Classes:

Attributes:

EVICTION_POLICIES module-attribute

EVICTION_POLICIES: set[EvictionPolicy] = set(
    get_args(EvictionPolicy)
)

A set of all possible eviction policies.

EvictionPolicy module-attribute

EvictionPolicy = Literal[
    "least-recently-used",
    "least-frequently-used",
    "most-recently-used",
    "first-in-first-out",
    "last-in-first-out",
]

Defines the possible eviction policies for the cache.

CacheItem

Bases: TypedDict

A cache item.

Attributes:

expiration instance-attribute

expiration: timedelta | None

The time until the item expires.

value instance-attribute

value: Required[bytes]

The value of the item.

ParamHashFunc

Bases: Protocol

A function that generates a hash for the given parameters.