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 630

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'));
    }
  }
}
doc_Drupal
2016-10-29 08:57:37
Comments
Leave a Comment

Please login to continue.