function ContentEntityStorageBase::getFromPersistentRevisionCache
Gets entity revisions from the persistent cache backend.
Parameters
int[] &$ids: Revision IDs to load from the revision cache. IDs that were found will be removed from the list.
Return value
\Drupal\Core\Entity\ContentEntityInterface[] Array of entities from the persistent cache.
2 calls to ContentEntityStorageBase::getFromPersistentRevisionCache()
- ContentEntityStorageBase::loadMultipleRevisions in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Loads multiple entity revisions.
- ContentEntityStorageBase::loadRevisionUnchanged in core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php - Loads an unchanged entity by revision ID from the database.
File
-
core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 1255
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function getFromPersistentRevisionCache(array &$ids) : array {
if (!$this->entityType
->isPersistentlyCacheable() || empty($ids)) {
return [];
}
$entities = [];
// Build the list of cache entries to retrieve.
$cid_map = [];
foreach ($ids as $id) {
$cid_map[$id] = $this->buildRevisionCacheId($id);
}
$cids = array_values($cid_map);
if ($cache = $this->cacheBackend
->getMultiple($cids)) {
// Get the entities that were found in the cache.
foreach ($ids as $index => $id) {
$cid = $cid_map[$id];
if (isset($cache[$cid])) {
$entities[$id] = $cache[$cid]->data;
unset($ids[$index]);
}
}
}
return $entities;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.