lithium\storage\cache\adapter\Redis::read()
Implements
lithium\storage\cache\Adapter::read()
Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.
Parameters
-
array
$keys
Keys to uniquely identify the cached items.
Returns
arrayCached values keyed by cache keys on successful read, keys which could not be read will not be included in the results array.
Source
public function read(array $keys) {
if (count($keys) > 1) {
$results = [];
$data = $this->connection->mGet($keys);
foreach ($data as $key => $item) {
$key = $keys[$key];
if ($item === false && !$connection->exists($key)) {
continue;
}
$results[$key] = $item;
}
return $results;
}
$result = $this->connection->get($key = current($keys));
return $result === false ? [] : [$key => $result];
}