/** * Remove all items from the cache. * * @return void */ public function flush() { if (!empty($this->tags)) { $this->tagVersions->flushTags($this->tags); } else { $this->connection()->flushdb(); } }
public function deserialize($prefix, array $data) { $data = ArrayTools::stripPrefixFromArrayKeys($prefix, $data); $data = array_map(function ($cacheItem) { return CacheItem::decode($cacheItem); }, $data); /** @var CacheItem[] $data */ foreach ($data as &$item) { if ($item->isExpired()) { $item = null; continue; } if ($this->tagVersions->isAnyTagExpired($item->getTags())) { $item = null; continue; } $value = $item->getValue(); $item = $this->isSimpleType($value) ? $value : $this->coderManager->decode($value); } return $data; }