public function ChainedStorageExpirable::getMultiple in Supercache 2.0.x
Same name and namespace in other branches
- 8 src/KeyValueStore/ChainedStorageExpirable.php \Drupal\supercache\KeyValueStore\ChainedStorageExpirable::getMultiple()
Returns the stored key/value pairs for a given set of keys.
@todo Determine the best return value for non-existing keys in https://www.drupal.org/node/2787737
Parameters
array $keys: A list of keys to retrieve.
Return value
array An associative array of items successfully returned, indexed by key.
Overrides DatabaseStorageExpirable::getMultiple
File
- src/
KeyValueStore/ ChainedStorageExpirable.php, line 91 - Contains \Drupal\supercache\KeyValueStore\ChainedStorageExpirable.
Class
- ChainedStorageExpirable
- Defines a default key/value store implementation for expiring items.
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)) {
// In order to populate the cache we need to know what the
// expiration times for each of these key value pairs are,
// and the DatabaseStorageExpirable implementation does
// not provide this.
$this->cache
->setMultiple($this
->KeyValueToCache($persisted, $this
->getExpirations(array_keys($persisted))));
}
$this
->populateMissingValuesLocal($keys, $persisted);
}
$result = $cached + $persisted;
return $result;
}