public function ContentEntityStorageBase::resetCache

public ContentEntityStorageBase::resetCache(array $ids = NULL)

Resets the internal, static entity cache.

Parameters

$ids: (optional) If specified, the cache is reset for the entities with the given ids only.

Overrides EntityStorageBase::resetCache

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 623

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

public function resetCache(array $ids = NULL) {
  if ($ids) {
    $cids = array();
    foreach ($ids as $id) {
      unset($this->entities[$id]);
      $cids[] = $this->buildCacheId($id);
    }
    if ($this->entityType->isPersistentlyCacheable()) {
      $this->cacheBackend->deleteMultiple($cids);
    }
  }
  else {
    $this->entities = array();
    if ($this->entityType->isPersistentlyCacheable()) {
      Cache::invalidateTags(array($this->entityTypeId . '_values'));
    }
  }
}

© 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!Entity!ContentEntityStorageBase.php/function/ContentEntityStorageBase::resetCache/8.1.x