Example #1
0
 /**
  * Constructor
  *
  * @param array $options
  */
 public function __construct($options = array())
 {
     if (!extension_loaded('xcache')) {
         throw new CacheException('The xcache extension must be loaded.');
     }
     parent::__construct($options);
 }
Example #2
0
 /**
  * Constructor
  *
  * @param array $options
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->options['cache_dir'] = '/tmp/cache';
     $this->options = $options + $this->options;
     $this->options['cache_dir'] = rtrim($this->options['cache_dir'], '\\/');
 }
Example #3
0
 /**
  * Constructor
  *
  * @param array $options
  * @throws CacheException
  */
 public function __construct($options = array())
 {
     if (!extension_loaded("yac")) {
         throw new CacheException('extension yac is not exist!');
     }
     parent::__construct($options);
     $name = isset($this->options['name']) ? $this->options['name'] : 'yaf-cache';
     $this->conn = new \Yac($name);
 }
Example #4
0
 /**
  * Constructor
  *
  * @param array $options
  */
 public function __construct($options = array())
 {
     if (!extension_loaded("memcache")) {
         throw new CacheException('extension memcache is not exist!');
     }
     parent::__construct($options);
     $this->conn = new \Memcache();
     foreach ($this->options['servers'] as $server) {
         call_user_func_array(array($this->conn, 'addServer'), $server);
     }
 }
Example #5
0
 /**
  * Constructor
  *
  * @param array $options
  */
 public function __construct($options = array())
 {
     if (!extension_loaded("memcached")) {
         throw new CacheException('extension memcached is not exist!');
     }
     parent::__construct($options);
     if (isset($this->options['persistent'])) {
         $this->conn = new \Memcached($this->options['persistent']);
     } else {
         $this->conn = new \Memcached();
     }
     $this->conn->addServers($this->options['servers']);
 }
Example #6
0
 /**
  * Constructor
  *
  * @param array $options
  * @throws CacheException
  */
 public function __construct($options = array())
 {
     if (!extension_loaded("redis")) {
         throw new CacheException('extension redis is not exist!');
     }
     parent::__construct($options);
     $this->conn = new \Redis();
     if (empty($this->options['persistent'])) {
         $this->conn->connect($this->options['host'], $this->options['port'], $this->options['timeout']);
     } else {
         $this->conn->pconnect($this->options['host'], $this->options['port'], $this->options['timeout']);
     }
     foreach ($this->optionKeys as $key) {
         if (isset($this->options[$key])) {
             $this->conn->setOption($key, $this->options[$key]);
         }
     }
 }