1.14.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.12.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.10.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.11.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.13.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.7.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.8.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)
1.9.x cache.inc BackdropCacheInterface::set($cid, $data, $expire = CACHE_PERMANENT)

Stores data in the persistent cache.

Parameters

string $cid: The cache ID of the data to store.

mixed $data: The data to store in the cache. Complex data types will be automatically serialized before insertion. Strings will be stored as plain text and not serialized. Some storage engines only allow objects up to a maximum of 1MB in size to be stored by default. When caching large arrays or similar, take care to ensure $data does not exceed this size.

int $expire: (optional) One of the following values:

  • CACHE_PERMANENT: Indicates that the item should never be removed unless explicitly told to using cache_clear_all() with a cache ID.
  • CACHE_TEMPORARY: Indicates that the item should be removed at the next general cache wipe.
  • A Unix timestamp: Indicates that the item should be kept at least until the given time, after which it behaves like CACHE_TEMPORARY.

File

includes/cache.inc, line 295
Functions and interfaces for cache handling.

Class

BackdropCacheInterface
Defines an interface for cache implementations.

Code

function set($cid, $data, $expire = CACHE_PERMANENT);