protected function ContentEntityStorageBase::getFromPersistentCache in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php \Drupal\Core\Entity\ContentEntityStorageBase::getFromPersistentCache()
Gets entities from the persistent cache backend.
Parameters
array|null &$ids: If not empty, return entities that match these IDs. IDs that were found will be removed from the list.
Return value
\Drupal\Core\Entity\ContentEntityInterface[] Array of entities from the persistent cache.
1 call to ContentEntityStorageBase::getFromPersistentCache()
- SqlContentEntityStorage::doLoadMultiple in core/
lib/ Drupal/ Core/ Entity/ Sql/ SqlContentEntityStorage.php - Performs storage-specific loading of entities.
File
- core/
lib/ Drupal/ Core/ Entity/ ContentEntityStorageBase.php, line 566 - Contains \Drupal\Core\Entity\ContentEntityStorageBase.
Class
- ContentEntityStorageBase
- Base class for content entity storage handlers.
Namespace
Drupal\Core\EntityCode
protected function getFromPersistentCache(array &$ids = NULL) {
if (!$this->entityType
->isPersistentlyCacheable() || empty($ids)) {
return array();
}
$entities = array();
// Build the list of cache entries to retrieve.
$cid_map = array();
foreach ($ids as $id) {
$cid_map[$id] = $this
->buildCacheId($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;
}