public function flushTags(array $tagNames, $version = null)
 {
     if (empty($tagNames)) {
         return [];
     }
     $tags = array_flip($tagNames);
     $version = $version ?: time();
     foreach ($tags as &$tagVersion) {
         $tagVersion = $version;
     }
     $prefixedTags = ArrayTools::addPrefixToArrayKeys($this->prefix, $tags);
     $this->connection()->mset($prefixedTags);
     $this->actualTagVersions = array_merge($this->actualTagVersions, $tags);
     return $tags;
 }
 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;
 }
 public function testStripPrefixFromArrayKeys()
 {
     $values = ['prefix:aaa' => '111', 'prefix:bbb' => '222'];
     $prefixedValues = ArrayTools::stripPrefixFromArrayKeys('prefix:', $values);
     $this->assertEquals(['aaa' => '111', 'bbb' => '222'], $prefixedValues);
 }
 /**
  * @param array $keys
  *
  * @return array|void
  */
 public function mget(array $keys)
 {
     $keys = ArrayTools::addPrefixToArrayValues($this->prefix, $keys);
     $data = $this->connection()->mget($keys);
     $data = $this->serializer->deserialize($this->prefix, $data);
     return $data;
 }