public function CacheCollector::has

public CacheCollector::has($key)

Returns whether data exists for this key.

Parameters

string $key: Key that identifies the data.

Overrides CacheCollectorInterface::has

File

core/lib/Drupal/Core/Cache/CacheCollector.php, line 133

Class

CacheCollector
Default implementation for CacheCollectorInterface.

Namespace

Drupal\Core\Cache

Code

public function has($key) {
  // Make sure the value is loaded.
  $this->get($key);
  return isset($this->storage[$key]) || array_key_exists($key, $this->storage);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!CacheCollector.php/function/CacheCollector::has/8.1.x