function EntityStorageBase::resetCache

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::resetCache()

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 190

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function resetCache(array $ids = NULL) {
  if ($this->entityType
    ->isStaticallyCacheable() && isset($ids)) {
    foreach ($ids as $id) {
      $this->memoryCache
        ->delete($this->buildCacheId($id));
    }
  }
  else {
    // Call the backend method directly.
    $this->memoryCache
      ->invalidateTags([
      $this->memoryCacheTag,
    ]);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.