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', ''); }
/** * 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']); } }
/** * 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!'); } } }
public function initialize(IConfigParameter $configuration) { if (!extension_loaded('apc')) { throw new SoftwareSupportException("APC extension not loaded"); } if ($configuration->get('id') === null) { throw new CacheException("Cache module must have id"); } // Need checking for necessary cache id Project::getCacheManager()->set($configuration->get('id'), $this); parent::initialize($configuration); }
public function initialize(IConfigParameter $configuration) { parent::initialize($configuration); $engine = new Cache_Lite(); if (!$configuration->get('directory')) { throw new CacheException('FileCache: cache directory not specified'); } $engine->_cacheDir = Project::NS()->path($configuration->get('directory')); if ($configuration->get('file_name')) { $engine->_fileName = $configuration->get('file_name'); } else { $engine->_fileName = "file.cache"; } $this->_engine = $engine; Project::getCacheManager()->set($configuration->get('id'), $this); }
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."); } } }
public function initialize(IConfigParameter $configuration) { if (!extension_loaded('sqlite_open')) { throw new SoftwareSupportException('SQL extension not loaded'); } if ($this->_file === null) { // TODO:: need getting directory to storing file and check permissions $this->_file = 'sqlite.cache'; } $error = ''; if (($this->_db = new SQLiteDatabase($this->_file, 0666, $error)) === false) { throw new CacheException('Error connection to sqlite server', $error); } if (@$this->_db->query('DELETE FROM ' . $this->_cache_table . ' WHERE expire<>0 AND expire<' . time()) === false) { if ($this->_db->query('CREATE TABLE ' . $this->_cache_table . ' (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)') === false) { throw new CacheException('Errir creation sqlite table', sqlite_error_string(sqlite_last_error())); } } $this->_initialized = true; parent::initialize($configuration); Project::getCacheManager()->set($configuration->get('id'), $this); }
public function __construct($enabled = true, $options = []) { parent::__construct($enabled && function_exists('apcu_add'), $options); }
public function set_enable($val = true) { parent::set_enable($val); $this->instance->set_enable($val); }