cache_get¶
-
classmethod
CacheManagerMixin.
cache_get
(key: str, default: Any = None, fail: bool = False, auto_prefix=True, fallback_prefix: bool = True)[source]¶ This is a simple helper method which calls
cached.get()
- while automatically prependingcache_prefix
andcache_sep
before the key.- Parameters
key (str) – The cache key (as a string) to get the value for, e.g.
example:test
default (Any) – If the cache key
key
isn’t found / is expired, return this value (Default:None
)fail (bool) – If set to
True
, will raiseCacheNotFound
instead of returningdefault
when a key is non-existent / expired.auto_prefix (bool) – If set to
True
, will auto-prependcache_prefix
tokey
if it’s not present.fallback_prefix (bool) – If set to
True
, if we fail to findkey
with the prefix prepended, then we’ll retry a cache lookup WITHOUT the key prefix.
- Raises
CacheNotFound – Raised when
fail=True
andkey
was not found in cache / expired.- Return Any value
The value of the cache key
key
, ordefault
if it wasn’t found.