You are here

public function Redis_Cache_PhpRedis::getMultiple in Redis 7.3

Same name and namespace in other branches
  1. 7 lib/Redis/Cache/PhpRedis.php \Redis_Cache_PhpRedis::getMultiple()
  2. 7.2 lib/Redis/Cache/PhpRedis.php \Redis_Cache_PhpRedis::getMultiple()

File

lib/Redis/Cache/PhpRedis.php, line 60

Class

Redis_Cache_PhpRedis
Predis cache backend.

Code

public function getMultiple(array $idList) {
  $client = $this
    ->getClient();
  $ret = array();
  $pipe = $client
    ->multi(Redis::PIPELINE);
  foreach ($idList as $id) {
    $pipe
      ->hgetall($this
      ->getKey($id));
  }
  $replies = $pipe
    ->exec();
  foreach (array_values($idList) as $line => $id) {
    if (!empty($replies[$line]) && is_array($replies[$line])) {
      $ret[$id] = $replies[$line];
    }
  }
  return $ret;
}