/** * Removes the specified item from the cache. * @param string key * @return void * @throws InvalidArgumentException */ public function offsetUnset($key) { if (!is_string($key)) { throw new InvalidArgumentException("Cache key name must be string, " . gettype($key) . " given."); } $this->key = $this->data = NULL; $this->storage->remove($this->namespace . $key); }
/** * Removes the specified item from the cache. * @param string key * @return void * @throws InvalidArgumentException */ public function offsetUnset($key) { if (!is_string($key) && !is_int($key)) { throw new InvalidArgumentException("Cache key name must be string or integer, " . gettype($key) . " given."); } $this->key = $this->data = NULL; $this->storage->remove($this->namespace . self::NAMESPACE_SEPARATOR . $key); }
/** * Retrieves the specified item from the cache or NULL if the key is not found (ArrayAccess implementation). * @param string key * @return mixed|NULL * @throws InvalidArgumentException */ public function offsetGet($key) { if (!is_string($key) && !is_int($key)) { throw new InvalidArgumentException("Cache key name must be string or integer, " . gettype($key) . " given."); } $key = (string) $key; if ($this->key === $key) { return $this->data; } $this->key = $key; $this->data = $this->storage->read($this->namespace . self::NAMESPACE_SEPARATOR . $key); return $this->data; }
/** * Removes items from the cache by conditions. * Conditions are: * - Cache::PRIORITY => (int) priority * - Cache::TAGS => (array) tags * - Cache::ALL => TRUE * * @param array * @return void */ public function clean(array $conds = NULL) { $this->release(); $this->storage->clean((array) $conds); }