Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
Overrides CacheBackendInterface::getMultiple
public function getMultiple(&$cids, $allow_invalid = FALSE) {
try {
// When serving cached pages, the overhead of using ::select() was found
// to add around 30% overhead to the request. Since $this->bin is a
// variable, this means the call to ::query() here uses a concatenated
// string. This is highly discouraged under any other circumstances, and
// is used here only due to the performance overhead we would incur
// otherwise. When serving an uncached page, the overhead of using
// ::select() is a much smaller proportion of the request.
$result = Database::getConnection()
->query('SELECT cid, data, created, expire, serialized, tags, checksum_invalidations, checksum_deletions FROM {' . Database::getConnection()
->escapeTable($this->bin) . '} WHERE cid IN (:cids)', array(
':cids' => $cids,
));
$cache = array();
foreach ($result as $item) {
$item = $this
->prepareItem($item, $allow_invalid);
if ($item) {
$cache[$item->cid] = $item;
}
}
$cids = array_diff($cids, array_keys($cache));
return $cache;
} catch (Exception $e) {
// If the database is never going to be available, cache requests should
// return FALSE in order to allow exception handling to occur.
return array();
}
}