The passed default value is returned for keys that don't exist.
Any integer or string value is accepted as key. If any other type is
passed for the key, an {@link InvalidKeyException} is thrown. You should
make sure that you only pass valid keys to the store.
If the backend of the store cannot be read, a {@link ReadException}
is thrown. You should always handle this exception in your code:
php
try {
$value = $store->getMultiple(array($key1, $key2));
} catch (ReadException $e) {
read failed
}
private function loadAllBindings() { $keysToFetch = array(); foreach ($this->keysByTypeName as $key) { if (!isset($this->bindingsByKey[$key])) { $keysToFetch[] = 'b:' . $key; } } $fetchedBindings = $this->store->getMultiple($keysToFetch); foreach ($fetchedBindings as $key => $bindingsForKey) { $this->bindingsByKey[$key] = $bindingsForKey ?: array(); $this->initializeBindings($this->bindingsByKey[$key]); } }
/** * {@inheritdoc} */ public function getMultiple(array $keys, $default = null) { return $this->store->getMultiple($keys, $default); }