You are here

class Redis_Cache in Redis 7.2

Same name and namespace in other branches
  1. 7.3 lib/Redis/Cache.php \Redis_Cache

Cache backend for Redis module.

Hierarchy

Expanded class hierarchy of Redis_Cache

File

lib/Redis/Cache.php, line 6

View source
class Redis_Cache implements DrupalCacheInterface {

  /**
   * @var DrupalCacheInterface
   */
  protected $backend;
  function __construct($bin) {
    $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_CACHE);
    $this->backend = new $className($bin);
  }
  function get($cid) {
    return $this->backend
      ->get($cid);
  }
  function getMultiple(&$cids) {
    return $this->backend
      ->getMultiple($cids);
  }
  function set($cid, $data, $expire = CACHE_PERMANENT) {
    $this->backend
      ->set($cid, $data, $expire);
  }
  function clear($cid = NULL, $wildcard = FALSE) {

    // This function also accepts arrays, thus handle everything like an array.
    $cids = is_array($cid) ? $cid : array(
      $cid,
    );
    foreach ($cids as $cid) {
      $this->backend
        ->clear($cid, $wildcard);
    }
  }
  function isEmpty() {
    return $this->backend
      ->isEmpty();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Redis_Cache::$backend protected property
Redis_Cache::clear function Expires data from the cache. Overrides DrupalCacheInterface::clear
Redis_Cache::get function Returns data from the persistent cache. Overrides DrupalCacheInterface::get
Redis_Cache::getMultiple function Returns data from the persistent cache when given an array of cache IDs. Overrides DrupalCacheInterface::getMultiple
Redis_Cache::isEmpty function Checks if a cache bin is empty. Overrides DrupalCacheInterface::isEmpty
Redis_Cache::set function Stores data in the persistent cache. Overrides DrupalCacheInterface::set
Redis_Cache::__construct function