protected function EdgeEntityStorageBase::getFromPersistentCache in Apigee Edge 8
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\EntityInterface[] Array of entities from the persistent cache.
2 calls to EdgeEntityStorageBase::getFromPersistentCache()
- DeveloperAppStorage::getFromCache in tests/
modules/ apigee_edge_test/ src/ Entity/ Storage/ DeveloperAppStorage.php - Exposes getFromPersistentCache() as a public method.
- EdgeEntityStorageBase::doLoadMultiple in src/
Entity/ Storage/ EdgeEntityStorageBase.php - Performs storage-specific loading of entities.
File
- src/
Entity/ Storage/ EdgeEntityStorageBase.php, line 360
Class
- EdgeEntityStorageBase
- Base entity storage class for Apigee Edge entities.
Namespace
Drupal\apigee_edge\Entity\StorageCode
protected function getFromPersistentCache(array &$ids = NULL) {
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
->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;
}