function Redis_Cache_Predis::get in Redis 7.2
Same name and namespace in other branches
- 7.3 lib/Redis/Cache/Predis.php \Redis_Cache_Predis::get()
 - 7 lib/Redis/Cache/Predis.php \Redis_Cache_Predis::get()
 
Returns data from the persistent cache.
Data may be stored as either plain text or as serialized data. cache_get() will automatically return unserialized objects and arrays.
Parameters
$cid: The cache ID of the data to retrieve.
Return value
The cache or FALSE on failure.
Overrides DrupalCacheInterface::get
File
- lib/
Redis/ Cache/ Predis.php, line 8  
Class
- Redis_Cache_Predis
 - Predis cache backend.
 
Code
function get($cid) {
  $client = Redis_Client::getClient();
  $key = $this
    ->getKey($cid);
  $cached = $client
    ->hgetall($key);
  if (empty($cached)) {
    return FALSE;
  }
  $cached = (object) $cached;
  if ($cached->serialized) {
    $cached->data = unserialize($cached->data);
  }
  return $cached;
}