Exemple #1
0
 /**
  * Create a new lock backend with a generated lock id
  *
  * @return Redis_Lock_BackendInterface
  */
 public function createLockBackend()
 {
     if (!$this->getLockBackendClass()) {
         throw new \Exception("Lock backend class does not exist");
     }
     $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_LOCK);
     return $this->backends[] = new $className(Redis_Client::getClient(), Redis_Client::getDefaultPrefix('lock'));
 }
Exemple #2
0
 /**
  * Get actual lock backend.
  * 
  * @return Redis_Lock_Backend_Interface
  */
 public static function getBackend()
 {
     if (!isset(self::$instance)) {
         $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_LOCK);
         self::$instance = new $className();
     }
     return self::$instance;
 }
 /**
  * Create a new lock backend with a generated lock id
  *
  * @return Redis_Lock_Backend_Interface
  */
 public function createLockBackend()
 {
     $class = Redis_Client::getClass(Redis_Client::REDIS_IMPL_LOCK);
     if (!class_exists($class)) {
         throw new \Exception("Lock backend class does not exist");
     }
     return $this->backends[] = new $class();
 }
 /**
  * Get cache backend
  *
  * @return Redis_Cache_Base
  */
 protected final function getBackend()
 {
     if (null === $this->backend) {
         $class = Redis_Client::getClass(Redis_Client::REDIS_IMPL_CACHE);
         if (null === $class) {
             throw new \Exception("Test skipped due to missing driver");
         }
         $this->backend = new $class('cache');
     }
     return $this->backend;
 }
Exemple #5
0
 /**
  * Get cache backend
  *
  * @return Redis_Path_HashLookupInterface
  */
 protected final function getBackend($name = null)
 {
     if (null === $name) {
         // This is needed to avoid conflict between tests, each test
         // seems to use the same Redis namespace and conflicts are
         // possible.
         $name = 'cache' . self::$id++;
     }
     $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_PATH);
     $hashLookup = new $className(Redis_Client::getClient(), 'path', Redis_Client::getDefaultPrefix('path'));
     return $hashLookup;
 }
Exemple #6
0
    public function __construct($bin)
    {
        $this->bin = $bin;

        $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_CACHE);
        $this->backend = new $className(Redis_Client::getClient(), $bin, Redis_Client::getDefaultPrefix($bin));

        $this->refreshCapabilities();
        $this->refreshPermTtl();
        $this->refreshMaxTtl();
    }
Exemple #7
0
 /**
  * Default contructor
  *
  * Beware that DrupalQueueInterface does not defines the __construct
  * method in the interface yet is being used from DrupalQueue::get() 
  *
  * @param unknown $name
  */
 public function __construct($name)
 {
     $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_QUEUE);
     $this->backend = new $className($name);
 }
Exemple #8
0
 public function __construct($namespace)
 {
     parent::__construct($namespace);
     $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_CACHE);
     $this->backend = new $className($this->getKey());
     $this->refreshClearMode();
     $this->refreshPermTtl();
     $this->refreshMaxTtl();
 }
Exemple #9
0
 function __construct($bin)
 {
     $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_CACHE);
     $this->backend = new $className($bin);
 }