eZ\Publish\Core\Persistence\Cache\CacheServiceDecorator::clear PHP Méthode

clear() public méthode

Clears the cache for the key, or if none is specified clears the entire cache. The key can be either a series of string arguments, or an array.
public clear ( )
    public function clear()
    {
        $item = call_user_func_array(array($this, 'getItem'), func_get_args());
        return $item->clear();
    }

Usage Example

 /**
  * Clear all user persistence cache.
  *
  * @param int|null $id Purges all users cache if null
  * @throws \eZ\Publish\Core\Base\Exceptions\InvalidArgumentType On invalid $id type
  */
 public function user($id = null)
 {
     if ($this->allCleared === true || $this->isSwitchedOff()) {
         return;
     }
     if ($id === null) {
         $this->cache->clear('user');
     } elseif (is_scalar($id)) {
         $this->cache->clear('user', $id);
     } else {
         throw new InvalidArgumentType('$id', 'int|null', $id);
     }
 }
All Usage Examples Of eZ\Publish\Core\Persistence\Cache\CacheServiceDecorator::clear