You are here

public function Redis_Cache::get in Redis 7.3

Same name and namespace in other branches
  1. 7.2 lib/Redis/Cache.php \Redis_Cache::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.php, line 397

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 get($cid) {
  $values = $this->backend
    ->get($cid);
  if (empty($values)) {
    return false;
  }
  list($flushPerm, $flushVolatile) = $this
    ->getLastFlushTime();
  $entry = $this
    ->expandEntry($values, $flushPerm, $flushVolatile);
  if (!$entry) {

    // This entry exists but is invalid.
    $this->backend
      ->delete($cid);
    return false;
  }
  return $entry;
}