aries_cloudagent.cache package¶
Submodules¶
aries_cloudagent.cache.base module¶
Abstract base classes for cache.
-
class
aries_cloudagent.cache.base.BaseCache[source]¶ Bases:
abc.ABCAbstract cache interface.
-
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: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.core.error.BaseErrorBase class for cache-related errors.
-
class
aries_cloudagent.cache.base.CacheKeyLock(cache: aries_cloudagent.cache.base.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.
-
done¶ Accessor for the done state.
-
future¶ Fetch the result in the form of an awaitable future.
-
parent¶ Accessor for the parent key lock, if any.
-
result¶ Fetch the current result, if any.
-
aries_cloudagent.cache.basic module¶
Basic in-memory cache implementation.
-
class
aries_cloudagent.cache.basic.BasicCache[source]¶ Bases:
aries_cloudagent.cache.base.BaseCacheBasic in-memory cache class.
-
clear(key: str)[source]¶ Remove an item from the cache, if present.
Parameters: key – the key to remove
-
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
-
set(keys: Union[str, Sequence[str]], value: Any, ttl: 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
-