public function ChainedStorage::getMultiple in Supercache 8
Same name and namespace in other branches
- 2.0.x src/KeyValueStore/ChainedStorage.php \Drupal\supercache\KeyValueStore\ChainedStorage::getMultiple()
Returns the stored key/value pairs for a given set of keys.
@todo What's returned for non-existing keys?
Parameters
array $keys: A list of keys to retrieve.
Return value
array An associative array of items successfully returned, indexed by key.
Overrides DatabaseStorage::getMultiple
File
- src/
KeyValueStore/ ChainedStorage.php, line 77 - Contains \Drupal\supercache\KeyValueStore\ChainedStorage;
Class
- ChainedStorage
- Defines a chained key value storage that uses any cache backend on top of the database default key/value storage.
Namespace
Drupal\supercache\KeyValueStoreCode
public function getMultiple(array $keys) {
$cached = [];
if ($cache = $this->cache
->getMultiple($keys)) {
$cached = $this
->CacheToKeyValue($cache);
}
$persisted = [];
if (!empty($keys)) {
$persisted = parent::getMultiple($keys);
if (!empty($persisted)) {
$this->cache
->setMultiple($this
->KeyValueToCache($persisted));
}
$this
->populateMissingValuesLocal($keys, $persisted);
}
$result = array_merge($cached, $persisted);
return $result;
}