/**
  * Set tags to an item by given key.
  * An empty array will remove all tags.
  *
  * @param string $key
  * @param string[] $tags
  * @return bool
  */
 public function setTags($key, array $tags)
 {
     if (empty($tags)) {
         parent::removeItem($this->itemTagsKey($key));
         return true;
     }
     $this->verifyTags($key);
     // set unset verification tags
     return parent::setItem($this->itemTagsKey($key), ['tags' => $tags, 'time' => time()]);
 }
Exemple #2
0
 /**
  * GzEncodes an item for storage
  *
  * @param  string $key
  * @param  mixed $value
  * @return bool
  */
 public function setItem($key, $value)
 {
     return $this->storageInterface->setItem($key, gzencode($value));
 }