cache_set

classmethod CacheManagerMixin.cache_set(key: str, value: Any, timeout: Optional[Union[decimal.Decimal, int, float, str]] = <class 'privex.helpers.types.AutoDetected'>, auto_prefix: bool = True)[source]

This is a simple helper method which calls cached.set() - while automatically prepending cache_prefix and cache_sep before the key, plus when timeout=AUTO ( AUTO ), the timeout will be automatically set to the default timeout: default_cache_time

Parameters
  • key (str) – NOTE: Key will be auto-prepended with cache_prefixx - The cache key (as a string) to set the value for, e.g. ``example:test`

  • value (Any) – The value to store in the cache key key

  • timeout (int) – The amount of seconds to keep the data in cache. Pass None to disable expiration.

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

Returns