store.cache.backends.base
¶
Module Contents¶
Classes¶
Attributes¶
- store.cache.backends.base.DEFAULT_TIMEOUT¶
- class store.cache.backends.base.Cache(cache_configuration: Any)¶
- abstract get(uid: str, default: Any = None) Any ¶
Fetch a given resource from the cache.
If the resource does not exist, return default, which itself defaults to None. :param uid: the resource uid :param default: the default value if not found
- get_expiry_time(timeout: int = DEFAULT_TIMEOUT) float ¶
Return the expiry time based upon the provided timeout.
- Parameters:
timeout – timeout
- has_resource(uid: str) bool ¶
Return True if the uid is in the cache and has not expired.
- Parameters:
uid – the resource uid
- abstract set(uid: str, value: Any, timeout: int = DEFAULT_TIMEOUT) bool ¶
Set a value in the cache.
- Parameters:
uid – the cache entry uid
value – the object to cache
timeout – timeout to use for caching this value, otherwise the default cache timeout will be used.
- Returns:
True if the value is set, False in case of failure
- abstract delete(uid: str) None ¶
Delete a resource from the cache.
Do nothing if the uid does not exist. :param uid: the resource uid
- abstract clear() None ¶
Remove all values from the cache at once.
- close() None ¶
Close the cache connection.
- __contains__(uid: str) bool ¶
Return True if the resource is in the cache and has not expired.
- Parameters:
uid – the resource uid