/** * Returns cache object * * @return W3_Cache_Base */ function &_get_cache() { static $cache = array(); if (!isset($cache[0])) { $engine = $this->_config->get_string('pgcache.engine'); switch ($engine) { case 'memcached': $engineConfig = array('servers' => $this->_config->get_array('pgcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('pgcache.memcached.persistant')); break; case 'file': $engineConfig = array('cache_dir' => W3TC_CACHE_FILE_PGCACHE_DIR); break; case 'file_pgcache': $engineConfig = array('cache_dir' => W3TC_CACHE_FILE_PGCACHE_DIR, 'expire' => $this->_lifetime); break; default: $engineConfig = array(); } require_once W3TC_LIB_W3_DIR . '/Cache.php'; $cache[0] =& W3_Cache::instance($engine, $engineConfig); } return $cache[0]; }
/** * Returns cache object * * @return W3_Cache_Base */ function &_get_cache() { static $cache = array(); if (!isset($cache[0])) { $engine = $this->_config->get_string('dbcache.engine'); switch ($engine) { case 'memcached': $engineConfig = array('servers' => $this->_config->get_array('dbcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('dbcache.memcached.persistant')); break; case 'file': $engineConfig = array('cache_dir' => W3TC_CACHE_FILE_DBCACHE_DIR, 'locking' => $this->_config->get_boolean('dbcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush')); break; default: $engineConfig = array(); } require_once W3TC_LIB_W3_DIR . '/Cache.php'; $cache[0] =& W3_Cache::instance($engine, $engineConfig); } return $cache[0]; }
/** * Returns cache object * * @return W3_Cache_Base */ function _get_cache() { static $cache = array(); if (!isset($cache[0])) { $engine = $this->_config->get_string('pgcache.engine'); switch ($engine) { case 'memcached': $engineConfig = array('servers' => $this->_config->get_array('pgcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('pgcache.memcached.persistant')); break; case 'file': $engineConfig = array('section' => 'page', 'flush_parent' => w3_get_blog_id() == 0, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush')); break; case 'file_generic': if (w3_get_blog_id() == 0) { $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR; } else { $flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . w3_get_domain(w3_get_host()); } $engineConfig = array('exclude' => array('.htaccess'), 'expire' => $this->_lifetime, 'cache_dir' => W3TC_CACHE_PAGE_ENHANCED_DIR, 'locking' => $this->_config->get_boolean('pgcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'), 'flush_dir' => $flush_dir); break; default: $engineConfig = array(); } $engineConfig['use_expired_data'] = true; $engineConfig['module'] = 'pgcache'; $engineConfig['host'] = w3_get_host(); $engineConfig['instance_id'] = w3_get_instance_id(); w3_require_once(W3TC_LIB_W3_DIR . '/Cache.php'); $cache[0] = W3_Cache::instance($engine, $engineConfig); } return $cache[0]; }
/** * Returns cache object * * @param null $blog_id * @param string $group * @return W3_Cache_Base */ function _get_cache($blog_id = null, $group = 'transient') { static $cache = array(); if (is_null($blog_id) && $group != 'site-transient') { $blog_id = $this->_blog_id; } else { $blog_id = 0; } if (!isset($cache[$blog_id])) { $engine = $this->_config->get_string('fragmentcache.engine'); switch ($engine) { case 'memcached': $engineConfig = array('servers' => $this->_config->get_array('fragmentcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('fragmentcache.memcached.persistant')); break; case 'file': $engineConfig = array('section' => 'fragment', 'locking' => $this->_config->get_boolean('fragmentcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush')); break; default: $engineConfig = array(); } $engineConfig['blog_id'] = $blog_id; $engineConfig['module'] = 'fragmentcache'; $engineConfig['host'] = w3_get_host(); $engineConfig['instance_id'] = w3_get_instance_id(); w3_require_once(W3TC_LIB_W3_DIR . '/Cache.php'); $cache[$blog_id] = W3_Cache::instance($engine, $engineConfig); } return $cache[$blog_id]; }
/** * Returns cache object * * @return W3_Cache_Base */ function _get_cache() { static $cache = array(); if (!isset($cache[0])) { $engine = $this->_config->get_string('dbcache.engine'); switch ($engine) { case 'memcached': $engineConfig = array('servers' => $this->_config->get_array('dbcache.memcached.servers'), 'persistant' => $this->_config->get_boolean('dbcache.memcached.persistant')); break; case 'file': $engineConfig = array('use_wp_hash', true, 'section' => 'db', 'locking' => $this->_config->get_boolean('dbcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush')); break; default: $engineConfig = array(); } $engineConfig['module'] = 'dbcache'; $engineConfig['host'] = w3_get_host(); $engineConfig['instance_id'] = w3_get_instance_id(); w3_require_once(W3TC_LIB_W3_DIR . '/Cache.php'); $cache[0] = W3_Cache::instance($engine, $engineConfig); } return $cache[0]; }