betty.cache.no_op module¶
Provide no-op caching.
- final class betty.cache.no_op.NoOpCache[source]¶
-
Provide a cache that does nothing.
This can be pickled.
This is process-safe, which means you can safely use this between different processes.
- get(cache_item_id: str) AsyncIterator[CacheItem[Any] | None][source]¶
Get the cache item with the given ID.
- getset(cache_item_id: str) AsyncContextManager[tuple[CacheItem[Any] | None, Callable[[Any], Awaitable[None]]], bool | None][source]¶
- getset(cache_item_id: str, *, wait: Literal[False] = False) AsyncContextManager[tuple[CacheItem[Any] | None, Callable[[Any], Awaitable[None]] | None], bool | None]
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.