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 prependingcache_prefix
andcache_sep
before the key, plus whentimeout=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-prependcache_prefix
tokey
if it’s not present.
- Returns