betty.cache.no_op module¶
Provide no-op caching.
- class betty.cache.no_op.NoOpCache[source]¶
-
Provide a cache that does nothing.
- get(cache_item_id: str) collections.abc.AsyncIterator[betty.cache.CacheItem[Any] | None][source]¶
Get the cache item with the given ID.
- Parameters:
cache_item_id (
str)- Return type:
collections.abc.AsyncIterator[typing.Optional[betty.cache.CacheItem[typing.Any]]]
- getset(cache_item_id: str, *, wait: bool = True) AsyncContextManager[tuple[betty.cache.CacheItem[Any] | None, collections.abc.Callable[[Any], collections.abc.Awaitable[None]] | None]][source]¶
Get the cache item with the given ID, and provide a setter to add or update it within the same atomic operation.
If
waitisFalseand no lock can be acquired, returnNone, None. Otherwise return: 0. A cache item if one could be found, or elseNone. 1. An asynchronous setter that takes the cache item’s value as its only argument.- Parameters:
- Return type:
typing.AsyncContextManager[tuple[typing.Optional[betty.cache.CacheItem[typing.Any]],collections.abc.Callable[[typing.Any],collections.abc.Awaitable[None]] |None]]