view.cache

Utilities for caching responses from views.

Functions

days(number, /)

hours(number, /)

in_memory_cache([reset_frequency])

Decorator to cache the result from a given view in-memory.

minutes(number, /)

seconds(number, /)

Classes

BaseCache(callable)

Base class for caches.

InMemoryCache(callable, reset_frequency)

Wrapper class for a cache stored in memory.

class BaseCache(callable: Callable[P, T])

Bases: ABC, Generic[P, T]

Base class for caches.

callable: Callable[P, T]
abstract invalidate() None

Invalidate the cache.

class InMemoryCache(callable: Callable[P, T], reset_frequency: float)

Bases: BaseCache[P, T]

Wrapper class for a cache stored in memory.

callable: Callable[P, T]
invalidate() None

Invalidate the cache.

reset_frequency: float
days(number: int, /) int
hours(number: int, /) int
in_memory_cache(reset_frequency: int | None = None) Callable[[Callable[P, T]], InMemoryCache[P, T]]

Decorator to cache the result from a given view in-memory.

minutes(number: int, /) int
seconds(number: int, /) int