Exemple #1
0
 /**
  * Get actual lock backend.
  * 
  * @return Redis_Lock_BackendInterface
  */
 public static function getBackend()
 {
     if (!isset(self::$instance)) {
         $className = Redis_Client::getClass(Redis_Client::REDIS_IMPL_LOCK);
         self::$instance = new $className(Redis_Client::getClient(), Redis_Client::getDefaultPrefix('lock'));
     }
     return self::$instance;
 }
Exemple #2
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 #3
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 #4
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();
    }