/**
  * Cache an item
  *
  * @param string $key
  * @param mixed $value
  * @param int $expiry
  * 			How many seconds to cache this object for (no value uses the configured default)
  */
 public function store($key, $value, $expiry = 0)
 {
     if ($expiry == 0) {
         $expiry = $this->expiry;
     }
     $entry = new CacheItem();
     $entry->value = serialize($value);
     $entry->expireAt = time() + $expiry;
     $data = serialize($entry);
     $this->store->store($key, $data);
     $this->items[$key] = $entry;
 }
 /**
  * Cache an item
  *
  * @param string $key
  * @param mixed $value
  * @param int $expiry
  * 			How many seconds to cache this object for (no value uses the configured default)
  * @param array $tags
  *          Any tags to flag this item has
  */
 public function store($key, $value, $expiry = -1, $tags = null)
 {
     if ($expiry == -1) {
         $expiry = $this->expiry;
     }
     $entry = new SimpleCacheItem();
     $entry->value = serialize($value);
     $entry->stored = time();
     if ($expiry) {
         $entry->expireAt = time() + $expiry;
     } else {
         $entry->expireAt = 0;
     }
     $data = serialize($entry);
     $this->store->store($key, $data, $expiry);
     // if we've got tags, add this element to the list of keys stored for
     // a given tag
     if ($tags) {
         foreach ($tags as $tag) {
             $tagKey = $this->tagKey($tag);
             $tagStore = $this->get($tagKey);
             if (!$tagStore) {
                 $tagStore = array();
             }
             // we store the key in the map to prevent duplicated keys
             $tagStore[$key] = true;
             $this->store($tagKey, $tagStore, 0);
         }
     }
     $this->items[$key] = $entry;
 }