Neos\Cache\Frontend\FrontendInterface::set PHP Method

set() public method

Saves data in the cache.
public set ( string $entryIdentifier, mixed $data, array $tags = [], integer $lifetime = null ) : void
$entryIdentifier string Something which identifies the data - depends on concrete cache
$data mixed The data to cache - also depends on the concrete cache implementation
$tags array Tags to associate with this cache entry
$lifetime integer Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
return void
    public function set($entryIdentifier, $data, array $tags = [], $lifetime = null);

Usage Example

 /**
  * Puts data into the cache.
  *
  * @param string $id The cache id.
  * @param mixed $data The cache entry/data.
  * @param int $lifeTime The cache lifetime. If != 0, sets a specific lifetime for this cache entry (0 => infinite lifeTime).
  * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise.
  */
 public function save($id, $data, $lifeTime = 0)
 {
     $this->cache->set($this->convertCacheIdentifier($id), $data, [], $lifeTime);
 }