public CacheBackendInterface::set($cid, $data, $expire = Cache::PERMANENT, array $tags = array())
Stores data in the persistent cache.
Core cache implementations set the created time on cache item with microtime(TRUE) rather than REQUEST_TIME_FLOAT, because the created time of cache items should match when they are created, not when the request started. Apart from being more accurate, this increases the chance an item will legitimately be considered valid.
string $cid: The cache ID of the data to store.
mixed $data: The data to store in the cache. 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: One of the following values:
array $tags: An array of tags to be stored with the cache item. These should normally identify objects used to build the cache item, which should trigger cache invalidation when updated. For example if a cached item represents a node, both the node ID and the author's user ID might be passed in as tags. For example array('node' => array(123), 'user' => array(92)).
\Drupal\Core\Cache\CacheBackendInterface::get()
\Drupal\Core\Cache\CacheBackendInterface::getMultiple()
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array());
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!CacheBackendInterface.php/function/CacheBackendInterface::set/8.1.x