aries_cloudagent.cache package
Submodules
aries_cloudagent.cache.base module
Abstract base classes for cache.
- class aries_cloudagent.cache.base.BaseCache[source]
Bases:
ABC
Abstract cache interface.
- abstract async clear(key: str)[source]
Remove an item from the cache, if present.
- Parameters
key – the key to remove
- exception aries_cloudagent.cache.base.CacheError(*args, error_code: Optional[str] = None, **kwargs)[source]
Bases:
BaseError
Base class for cache-related errors.
- class aries_cloudagent.cache.base.CacheKeyLock(cache: BaseCache, key: str)[source]
Bases:
object
A 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 future: Future
Fetch the result in the form of an awaitable future.
- property parent: CacheKeyLock
Accessor for the parent key lock, if any.
aries_cloudagent.cache.in_memory module
Basic in-memory cache implementation.
- class aries_cloudagent.cache.in_memory.InMemoryCache[source]
Bases:
BaseCache
Basic 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: Union[str, Sequence[str]], value: Any, ttl: Optional[int] = 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