/** * 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. */ public function save(CacheItemInterface $item) { if (!$item->isHit()) { return false; } return $this->local->save($item) && $this->remote->save($item); }
/** * 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. */ public function save(CacheItemInterface $item) { if (!$item->isHit()) { return false; } $bytes = file_put_contents($this->filenameFor($item->getKey()), serialize($item)); return false !== $bytes; }
/** * 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. */ public function save(CacheItemInterface $item) { if (!$item->isHit()) { return false; } $this->stack[$item->getKey()] = $item; return true; }
/** * 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. */ public function save(CacheItemInterface $item) { if (!$item->isHit()) { return false; } if ($this->legacy) { $store = apc_store($item->getKey(), serialize($item)); } else { $store = apcu_store($item->getKey(), serialize($item)); } return $store; }
public function isHit() { return $this->decorated->isHit() && $this->isDecryptable(); }
/** * 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. */ public function save(CacheItemInterface $item) { if (!$item->isHit()) { return false; } return $this->cacheClient->add($item->getKey(), serialize($item)); }
/** * {@inheritdoc} */ public function save(CacheItemInterface $item) { // This item has no data if (!$item->isHit()) { return false; } if ($item instanceof TaggableItemInterface) { $key = $item->getTaggedKey(); } else { $key = $item->getKey(); } $timeToLive = null; if ($item instanceof HasExpirationDateInterface) { if (null !== ($expirationDate = $item->getExpirationDate())) { $timeToLive = $expirationDate->getTimestamp() - time(); } } return $this->storeItemInCache($key, $item, $timeToLive); }
/** * {@inheritdoc} */ public function isHit() { return $this->item->isHit(); }