Beispiel #1
0
 public function __construct($config)
 {
     if (!function_exists('xcache_set')) {
         throw new \Tygh\Exceptions\ClassNotFoundException('"XCache" PHP extension is not installed.');
     }
     if (isset($config['cache_xcache_global_ttl'])) {
         $this->global_ttl = (int) $config['cache_xcache_global_ttl'];
     }
     parent::__construct($config);
 }
Beispiel #2
0
 public function __construct($config)
 {
     if (!function_exists('apc_store') || !class_exists('APCIterator')) {
         throw new \Tygh\Exceptions\ClassNotFoundException('"APC" PHP extension is not installed.');
     }
     if (isset($config['cache_apc_global_ttl'])) {
         $this->global_ttl = (int) $config['cache_apc_global_ttl'];
     }
     parent::__construct($config);
 }
Beispiel #3
0
 public function __construct($config)
 {
     $this->_config = array('redis_server' => $config['cache_redis_server'], 'saas_uid' => !empty($config['saas_uid']) ? $config['saas_uid'] : null, 'global_ttl' => !empty($config['cache_redis_global_ttl']) ? $config['cache_redis_global_ttl'] : 0);
     parent::__construct($config);
     if ($this->connect($config)) {
         return true;
     }
     return false;
 }
Beispiel #4
0
 public function __construct($config)
 {
     $this->_config = array('store_prefix' => !empty($config['store_prefix']) ? $config['store_prefix'] : null, 'dir_cache' => $config['dir']['cache_registry']);
     $init_db = false;
     if (!file_exists($this->_dirCache() . 'cache.db')) {
         $init_db = true;
     }
     $this->db = $this->_dbInit();
     $this->_setTimeout($this->sqlite_timeout);
     if ($init_db == true) {
         $this->db->query('CREATE TABLE cache (name varchar(128), company_id int, data text, expiry int, tags varchar(64), PRIMARY KEY(name, company_id))');
         $this->db->query('CREATE INDEX tags ON cache (tags)');
         $this->db->query('CREATE INDEX company_id ON cache (company_id)');
         $this->db->query('CREATE INDEX exp ON cache (name, company_id, expiry)');
     }
     parent::__construct($config);
     return true;
 }
Beispiel #5
0
 public function __construct($config)
 {
     $this->_config = array('store_prefix' => !empty($config['store_prefix']) ? $config['store_prefix'] : null, 'dir_cache' => $config['dir']['cache_registry']);
     if (fn_mkdir($this->_mapTags('')) == false) {
         throw new PermissionsException('Cache: "' . $this->_mapTags('') . '" directory is not writable');
     }
     parent::__construct($config);
     return true;
 }
Beispiel #6
0
 public function __construct($config)
 {
     Db::$raw = true;
     if (!Db::getField("SHOW TABLES LIKE '?:cache'")) {
         Registry::set('runtime.database.skip_errors', true);
         Db::$raw = true;
         $res = Db::query('CREATE TABLE ?:cache (name varchar(255), company_id int(11) unsigned not null default \'0\', data mediumtext, expiry int, tags varchar(255), PRIMARY KEY(name, company_id), KEY (tags), KEY (name, company_id, expiry), KEY (company_id)) Engine=MyISAM DEFAULT CHARSET UTF8');
         Registry::set('runtime.database.skip_errors', false);
         if ($res == false) {
             throw new DatabaseException('Database cache data storage is not supported. Please choose another one.');
         }
     }
     parent::__construct($config);
     return true;
 }