public function Redis_Cache::getMultiple in Redis 7.3
Same name and namespace in other branches
- 7.2 lib/Redis/Cache.php \Redis_Cache::getMultiple()
Returns data from the persistent cache when given an array of cache IDs.
Parameters
$cids: An array of cache IDs for the data to retrieve. This is passed by reference, and will have the IDs successfully returned from cache removed.
Return value
An array of the items successfully returned from cache indexed by cid.
Overrides DrupalCacheInterface::getMultiple
File
- lib/
Redis/ Cache.php, line 420
Class
- Redis_Cache
- Because those objects will be spawned during boostrap all its configuration must be set in the settings.php file.
Code
public function getMultiple(&$cids) {
$ret = array();
$delete = array();
if (!$this->allowPipeline) {
$entries = array();
foreach ($cids as $cid) {
if ($entry = $this->backend
->get($cid)) {
$entries[$cid] = $entry;
}
}
}
else {
$entries = $this->backend
->getMultiple($cids);
}
list($flushPerm, $flushVolatile) = $this
->getLastFlushTime();
foreach ($cids as $key => $cid) {
if (!empty($entries[$cid])) {
$entry = $this
->expandEntry($entries[$cid], $flushPerm, $flushVolatile);
}
else {
$entry = null;
}
if (empty($entry)) {
$delete[] = $cid;
}
else {
$ret[$cid] = $entry;
unset($cids[$key]);
}
}
if (!empty($delete)) {
if ($this->allowPipeline) {
foreach ($delete as $id) {
$this->backend
->delete($id);
}
}
else {
$this->backend
->deleteMultiple($delete);
}
}
return $ret;
}