public function serialize($prefix, array $data, $minutes, array $tags)
 {
     $seconds = TimeTools::getTtlInSeconds($minutes);
     $tags = $this->tagVersions->getActualVersionsFor($tags);
     $data = ArrayTools::addPrefixToArrayKeys($prefix, $data);
     $data = array_map(function ($value) use($seconds, $tags) {
         return (string) CacheItem::encode($this->isSimpleType($value) ? $value : $this->coderManager->encode($value), $seconds, $tags);
     }, $data);
     return $data;
 }
 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 testAddPrefixToArrayKeys()
 {
     $values = ['aaa' => '111', 'bbb' => '222'];
     $prefixedValues = ArrayTools::addPrefixToArrayKeys('prefix:', $values);
     $this->assertEquals(['prefix:aaa' => '111', 'prefix:bbb' => '222'], $prefixedValues);
 }