Example #1
0
 /**
  * Checks if a key is valid for APCu cache storage
  *
  * @param $key
  * @throws InvalidArgumentException
  */
 private function assertValidKey($key)
 {
     if (!Item::isValidKey($key)) {
         throw new InvalidArgumentException('invalid key: ' . var_export($key, true));
     }
 }
 /**
  * Removes multiple items from the pool.
  *
  * @param array $keys
  *   An array of keys that should be removed from the pool.
  * @throws InvalidArgumentException
  *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException
  *   MUST be thrown.
  *
  * @return bool
  *   True if the items were successfully removed. False if there was an error.
  */
 public function deleteItems(array $keys)
 {
     foreach ($keys as $key) {
         if (!Item::isValidKey($key)) {
             throw new InvalidArgumentException('invalid key: ' . var_export($key, true));
         }
         $this->deleteDeferred($key);
     }
     // HHVM memcached doesn't have this method
     if (defined('HHVM_VERSION')) {
         // @codeCoverageIgnoreStart
         foreach ($keys as $key) {
             $this->deleteItem($key);
         }
     } else {
         // @codeCoverageIgnoreEnd
         $this->cacheClient->deleteMulti($keys);
     }
     return true;
 }