function ContentEntityStorageBase::setPersistentRevisionCache
Stores revisions in the persistent cache backend.
Parameters
\Drupal\Core\Entity\ContentEntityInterface[] $entities: Entities to store in the cache.
1 call to ContentEntityStorageBase::setPersistentRevisionCache()
- ContentEntityStorageBase::loadMultipleRevisions in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Loads multiple entity revisions.
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 1306
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function setPersistentRevisionCache(array $entities) : void {
if (!$this->entityType
->isPersistentlyCacheable()) {
return;
}
$items = [];
$cache_tags = [
'entity_field_info',
];
foreach ($entities as $entity) {
// When an entity is cleared from the entity cache via ::resetCache()
// we must clear the related revisions from the revision cache, as well.
// To make this possible, we add a tag with the entity's ID to the
// revision's cache entry.
// @see \Drupal\Core\Entity\ContentEntityStorageBase::resetCache()
$cache_tags[] = "{$this->entityTypeId}:{$entity->id()}:revisions";
$items[$this->buildRevisionCacheId($entity->getRevisionId())] = [
'data' => $entity,
'tags' => $cache_tags,
];
}
$this->cacheBackend
->setMultiple($items);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.