Exemplo n.º 1
0
 /**
  * Persists a cache item immediately.
  *
  * @param CacheItemInterface $item
  *   The cache item to save.
  *
  * @return bool
  *   True if the item was successfully persisted. False if there was an error.
  *
  * @throws InvalidArgumentException
  */
 public function save(CacheItemInterface $item)
 {
     $expirationTime = null;
     if ($item instanceof ExtractableCacheLifetimeInterface) {
         $expirationTime = $item->getCacheLifetime();
     }
     return $this->cacheFrontend->save(serialize($item instanceof ExtractableCacheValueInterface ? $item->getCacheValue() : $item->get()), $this->prepareKey($item->getKey()), $this->tags, $expirationTime);
 }