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 prepending cache_prefix and cache_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 raise CacheNotFound instead of returning default when a key is non-existent / expired.

  • auto_prefix (bool) – If set to True, will auto-prepend cache_prefix to key if it’s not present.

  • fallback_prefix (bool) – If set to True, if we fail to find key with the prefix prepended, then we’ll retry a cache lookup WITHOUT the key prefix.

Raises

CacheNotFound – Raised when fail=True and key was not found in cache / expired.

Return Any value

The value of the cache key key, or default if it wasn’t found.