function ContentEntityStorageBase::setStaticCache
Stores entities in the static entity and entity revision cache.
Parameters
\Drupal\Core\Entity\ContentEntityInterface[] $entities: Entities to store in the cache.
Overrides EntityStorageBase::setStaticCache
1 call to ContentEntityStorageBase::setStaticCache()
- ContentEntityStorageBase::loadUnchanged in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Loads an unchanged entity from the database.
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 1372
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function setStaticCache(array $entities) {
parent::setStaticCache($entities);
// Also make entities available in the static cache with their default
// revision as they are frequently accessed through their revision ID, for
// example when upcasting to the latest revision.
if ($this->entityType
->isStaticallyCacheable() && $this->entityType
->isRevisionable()) {
foreach ($entities as $entity) {
// @see \Drupal\Core\Entity\ContentEntityStorageBase::setPersistentRevisionCache()
$cache_tags_revision = [
$this->memoryCacheTag,
"{$this->entityTypeId}:{$entity->id()}:revisions",
];
$this->memoryCache
->set($this->buildRevisionCacheId($entity->getRevisionId()), $entity, MemoryCacheInterface::CACHE_PERMANENT, $cache_tags_revision);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.