Beispiel #1
0
 /**
  * Creates a redis cache driver.
  *
  * The following global constants affect operation:
  *
  * src_ACM_REDIS_HOST
  * src_ACM_REDIS_PORT
  * src_ACM_REDIS_PASSWORD
  * src_ACM_REDIS_DB
  *
  * There are no publicly documented constructor parameters.
  */
 function __construct()
 {
     // Call the parent constructor
     parent::__construct();
     $this->redis = new \Redis();
     $args = func_get_args();
     if (!empty($args)) {
         $ok = call_user_func_array(array($this->redis, 'connect'), $args);
     } else {
         $ok = $this->redis->connect(src_ACM_REDIS_HOST, src_ACM_REDIS_PORT);
     }
     if (!$ok) {
         trigger_error('Could not connect to redis server');
     }
     if (defined('src_ACM_REDIS_PASSWORD')) {
         if (!$this->redis->auth(src_ACM_REDIS_PASSWORD)) {
             global $acm_type;
             trigger_error("Incorrect password for the ACM module {$acm_type}.", E_USER_ERROR);
         }
     }
     $this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
     $this->redis->setOption(\Redis::OPT_PREFIX, $this->key_prefix);
     if (defined('src_ACM_REDIS_DB')) {
         if (!$this->redis->select(src_ACM_REDIS_DB)) {
             global $acm_type;
             trigger_error("Incorrect database for the ACM module {$acm_type}.", E_USER_ERROR);
         }
     }
 }
Beispiel #2
0
 function __construct()
 {
     parent::__construct();
     if (!function_exists('ini_get') || (int) ini_get('xcache.var_size') <= 0) {
         trigger_error('Increase xcache.var_size setting above 0 or enable ini_get() to use this ACM module.', E_USER_ERROR);
     }
 }
Beispiel #3
0
 function __construct()
 {
     // Call the parent constructor
     parent::__construct();
     $this->memcache = new \Memcache();
     foreach (explode(',', src_ACM_MEMCACHE) as $u) {
         $parts = explode('/', $u);
         $this->memcache->addServer(trim($parts[0]), trim($parts[1]));
     }
     $this->flags = src_ACM_MEMCACHE_COMPRESS ? MEMCACHE_COMPRESSED : 0;
 }