function ContentEntityStorageBase::resetCache
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::resetCache()
- 8.9.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::resetCache()
- 11.x core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::resetCache()
Resets the entity cache.
Content entities have both an in-memory static cache and a persistent cache. Use this method to clear all caches. To clear just the in-memory cache, use the 'entity.memory_cache' service.
Parameters
array $ids: (optional) If specified, the cache is reset for the entities with the given ids only.
Overrides EntityStorageBase::resetCache
4 calls to ContentEntityStorageBase::resetCache()
- TermStorage::resetCache in core/
modules/ taxonomy/ src/ TermStorage.php - UserStorage::deleteRoleReferences in core/
modules/ user/ src/ UserStorage.php - UserStorage::updateLastAccessTimestamp in core/
modules/ user/ src/ UserStorage.php - UserStorage::updateLastLoginTimestamp in core/
modules/ user/ src/ UserStorage.php
1 method overrides ContentEntityStorageBase::resetCache()
- TermStorage::resetCache in core/
modules/ taxonomy/ src/ TermStorage.php
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 1195
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
public function resetCache(?array $ids = NULL) {
if ($ids) {
parent::resetCache($ids);
if ($this->entityType
->isPersistentlyCacheable()) {
$cids = [];
foreach ($ids as $id) {
unset($this->latestRevisionIds[$id]);
$cids[] = $this->buildCacheId($id);
}
$this->cacheBackend
->deleteMultiple($cids);
}
}
else {
parent::resetCache();
if ($this->entityType
->isPersistentlyCacheable()) {
Cache::invalidateTags([
$this->entityTypeId . '_values',
]);
}
$this->latestRevisionIds = [];
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.