Пример #1
0
 public function __construct($enabled, array $options)
 {
     parent::__construct($enabled, $options);
     $this->set_default_options(['persist' => true]);
     $this->servers = $this->get_option('servers');
     $this->prefix = $this->get_option('prefix', '');
 }
Пример #2
0
 /**
  * Constructor	 
  */
 public function __construct()
 {
     parent::__construct('mymc');
     if (!isset(self::$_cache)) {
         // load config file
         global $memcache_i;
         self::$_cache = new Memcache();
         self::$_cache->connect($memcache_i['server'], $memcache_i['port']);
     }
 }
Пример #3
0
 /**
  * Constructor	 
  */
 public function __construct()
 {
     parent::__construct('mymc');
     if (!isset(self::$_initialized)) {
         if (extension_loaded('apc')) {
             self::$_initialized = true;
         } else {
             throw new Exception('APC extension is required!');
         }
     }
 }
Пример #4
0
 public function __construct($ttl = 0)
 {
     parent::__construct($ttl);
     if (empty(self::$_server)) {
         $mt = MT::get_instance();
         $servers = $mt->config('MemcachedServers');
         if (!empty($servers)) {
             if (extension_loaded('memcache')) {
                 self::$_server = new Memcache();
                 $this->connect($servers);
             } else {
                 require_once 'class.exception.php';
                 throw new MTException("Cannot load memcached extension.");
             }
         } else {
             require_once 'class.exception.php';
             throw new MTException("Cannot load memcached extension.");
         }
     }
 }
Пример #5
0
 public function __construct($enabled = true, $options = [])
 {
     parent::__construct($enabled && function_exists('apcu_add'), $options);
 }