acapy_agent.cache package
Submodules
acapy_agent.cache.base module
Abstract base classes for cache.
- class acapy_agent.cache.base.BaseCache[source]
Bases:
ABCAbstract cache interface.
- abstractmethod async clear(key: str)[source]
Remove an item from the cache, if present.
- Parameters:
key – the key to remove
- exception acapy_agent.cache.base.CacheError(*args, error_code: str | None = None, **kwargs)[source]
Bases:
BaseErrorBase class for cache-related errors.
- class acapy_agent.cache.base.CacheKeyLock(cache: BaseCache, key: str)[source]
Bases:
objectA lock on a particular cache key.
Used to prevent multiple async threads from generating or querying the same semi-expensive data. Not thread safe.
- property done: bool
Accessor for the done state.
- property future: Future
Fetch the result in the form of an awaitable future.
- property parent: CacheKeyLock
Accessor for the parent key lock, if any.
- property result: Any
Fetch the current result, if any.
acapy_agent.cache.in_memory module
Basic in-memory cache implementation.
- class acapy_agent.cache.in_memory.InMemoryCache[source]
Bases:
BaseCacheBasic in-memory cache class.
- async clear(key: str)[source]
Remove an item from the cache, if present.
- Parameters:
key – the key to remove
- async get(key: str)[source]
Get an item from the cache.
- Parameters:
key – the key to retrieve an item for
- Returns:
The record found or None
- async set(keys: str | Sequence[str], value: Any, ttl: int | None = None)[source]
Add an item to the cache with an optional ttl.
Overwrites existing cache entries.
- Parameters:
keys – the key or keys for which to set an item
value – the value to store in the cache
ttl – number of seconds that the record should persist