You are here

public function Redis_Cache_Predis::get in Redis 7.3

Same name and namespace in other branches
  1. 7 lib/Redis/Cache/Predis.php \Redis_Cache_Predis::get()
  2. 7.2 lib/Redis/Cache/Predis.php \Redis_Cache_Predis::get()

File

lib/Redis/Cache/Predis.php, line 43

Class

Redis_Cache_Predis
Predis cache backend.

Code

public function get($id) {
  $client = $this
    ->getClient();
  $key = $this
    ->getKey($id);
  $values = $client
    ->hgetall($key);

  // Recent versions of PhpRedis will return the Redis instance
  // instead of an empty array when the HGETALL target key does
  // not exists. I see what you did there.
  if (empty($values) || !is_array($values)) {
    return false;
  }
  return $values;
}