/** * Adds tags to existring data cache * Useful, when tags are generated after data is cached * (i.g. doctrine object cache) * * If appending tag already exists, we will compare version to save * tag with newest one * * @param string $key * @param array $tags * @return boolean */ public function addTagsToCache($key, array $tags) { $cacheMetadata = new CacheMetadata($this->getCache()->get($key)); $data = $cacheMetadata->getData(); if (null === $data) { return false; } $cacheMetadata->addTags($tags); $tags = $cacheMetadata->getTags(); return $this->set($key, $data, $this->getTTL($key), $tags); }