betty.caches.no_op module

Provide no-op caching.

final class betty.caches.no_op.NoOpCache

Bases: Cache[Any]

Provide a cache that does nothing.

async clear() None

Clear all items from the cache.

This operation s unsafe and MAY cause other concurrent operations on this cache to fail.

async delete(cache_item_id: str, /) None

Delete the cache item with the given ID.

This operation s unsafe and MAY cause other concurrent operations on this cache to fail.

async get(cache_item_id: str, /) CacheItem[Any] | None

Get the cache item with the given ID.

getset(cache_item_id: str, /) AsyncIterator[CacheItemValueSetter[Any] | CacheItem[Any]]

Get the cache item with the given ID, or provide a setter to add it within the same atomic operation.

async has(cache_item_id: str, /) bool

Check if a cache item with the given ID exists.

hasset(cache_item_id: str, /) AsyncIterator[CacheItemValueSetter[Any] | None]

Check if a cache item with the given ID exists, and if not, provide a setter to add or update it within the same atomic operation.

async set(cache_item_id: str, value: Any, *, modified: float | None = None) None

Add or update a cache item.

with_scope(scope: str, /) Self

Return a new nested cache with the given scope.