本文整理汇总了PHP中Util_Environment::instance_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::instance_id方法的具体用法?PHP Util_Environment::instance_id怎么用?PHP Util_Environment::instance_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::instance_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_cache
/**
* Returns minify cache object
*
* @return object
*/
function _get_cache()
{
static $cache = array();
if (!isset($cache[0])) {
switch ($this->_config->get_string('minify.engine')) {
case 'memcached':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify', 'servers' => $this->_config->get_array('minify.memcached.servers'), 'persistent' => $this->_config->get_boolean('minify.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('minify.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('minify.memcached.username'), 'password' => $this->_config->get_boolean('minify.memcached.password'));
if (class_exists('Memcached')) {
$w3_cache = new Cache_Memcached($config);
} else {
if (class_exists('Memcache')) {
$w3_cache = new Cache_Memcache($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'redis':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify', 'servers' => $this->_config->get_array('minify.redis.servers'), 'persistent' => $this->_config->get_boolean('minify.redis.persistent'), 'dbid' => $this->_config->get_boolean('minify.redis.dbid'), 'password' => $this->_config->get_boolean('minify.redis.password'));
if (class_exists('Memcached')) {
$w3_cache = new Cache_Memcached($config);
} else {
if (class_exists('Memcache')) {
$w3_cache = new Cache_Memcache($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'apc':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
if (function_exists('apcu_store')) {
$w3_cache = new Cache_Apcu($config);
} else {
if (function_exists('apc_store')) {
$w3_cache = new Cache_Apc($config);
}
}
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'eaccelerator':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Eaccelerator($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'xcache':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Xcache($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'wincache':
$config = array('blog_id' => Util_Environment::blog_id(), 'instance_id' => Util_Environment::instance_id(), 'host' => Util_Environment::host(), 'module' => 'minify');
$w3_cache = new Cache_Wincache($config);
$cache[0] = new \Minify_Cache_W3TCDerived($w3_cache);
break;
case 'file':
default:
$cache[0] = new \Minify_Cache_File(Util_Environment::cache_blog_minify_dir(), array('.htaccess', 'index.php', '*.old'), $this->_config->get_boolean('minify.file.locking'), $this->_config->get_integer('timelimit.cache_flush'), Util_Environment::blog_id() == 0 ? W3TC_CACHE_MINIFY_DIR : null);
break;
}
}
return $cache[0];
}
示例2: _get_cache
/**
* 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'), 'persistent' => $this->_config->get_boolean('dbcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('dbcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('dbcache.memcached.username'), 'password' => $this->_config->get_boolean('dbcache.memcached.password'));
break;
case 'redis':
$engineConfig = array('servers' => $this->_config->get_array('dbcache.redis.servers'), 'persistent' => $this->_config->get_boolean('dbcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('dbcache.redis.dbid'), 'password' => $this->_config->get_boolean('dbcache.redis.password'));
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'] = Util_Environment::host();
$engineConfig['instance_id'] = Util_Environment::instance_id();
$cache[0] = Cache::instance($engine, $engineConfig);
}
return $cache[0];
}
示例3: _get_cache
/**
* Returns cache object
*
* @param int|null $blog_id
* @param string $group
* @return W3_Cache_Base
*/
function _get_cache($blog_id = null, $group = '')
{
static $cache = array();
if (is_null($blog_id) && !in_array($group, $this->global_groups)) {
$blog_id = $this->_blog_id;
} elseif (is_null($blog_id)) {
$blog_id = 0;
}
if (!isset($cache[$blog_id])) {
$engine = $this->_config->get_string('objectcache.engine');
switch ($engine) {
case 'memcached':
$engineConfig = array('servers' => $this->_config->get_array('objectcache.memcached.servers'), 'persistent' => $this->_config->get_boolean('objectcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('objectcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('objectcache.memcached.username'), 'password' => $this->_config->get_boolean('objectcache.memcached.password'));
break;
case 'redis':
$engineConfig = array('servers' => $this->_config->get_array('objectcache.redis.servers'), 'persistent' => $this->_config->get_boolean('objectcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('objectcache.redis.dbid'), 'password' => $this->_config->get_boolean('objectcache.redis.password'));
break;
case 'file':
$engineConfig = array('section' => 'object', 'locking' => $this->_config->get_boolean('objectcache.file.locking'), 'flush_timelimit' => $this->_config->get_integer('timelimit.cache_flush'));
break;
default:
$engineConfig = array();
}
$engineConfig['blog_id'] = $blog_id;
$engineConfig['module'] = 'object';
$engineConfig['host'] = Util_Environment::host();
$engineConfig['instance_id'] = Util_Environment::instance_id();
$cache[$blog_id] = Cache::instance($engine, $engineConfig);
}
return $cache[$blog_id];
}
示例4: _get_cache
/**
* Returns cache object
*
* @param null $blog_id
* @param string $group
* @return W3_Cache_Base
*/
function _get_cache($global = false)
{
static $cache = array();
if (!$global) {
$blog_id = $this->_blog_id;
} else {
$blog_id = 0;
}
if (!isset($cache[$blog_id])) {
$engine = $this->_config->get_string(array('fragmentcache', 'engine'));
switch ($engine) {
case 'memcached':
$engineConfig = array('servers' => $this->_config->get_array(array('fragmentcache', 'memcached.servers')), 'persistent' => $this->_config->get_boolean(array('fragmentcache', 'memcached.persistent')), 'aws_autodiscovery' => $this->_config->get_boolean(array('fragmentcache', 'memcached.aws_autodiscovery')), 'username' => $this->_config->get_boolean(array('fragmentcache', 'memcached.username')), 'password' => $this->_config->get_boolean(array('fragmentcache', 'memcached.password')));
break;
case 'redis':
$engineConfig = array('servers' => $this->_config->get_array(array('fragmentcache', 'redis.servers')), 'persistent' => $this->_config->get_boolean(array('fragmentcache', 'redis.persistent')), 'dbid' => $this->_config->get_boolean(array('fragmentcache', 'redis.dbid')), 'password' => $this->_config->get_boolean(array('fragmentcache', 'redis.password')));
break;
case 'file':
$engineConfig = array('section' => 'fragment', 'locking' => $this->_config->get_boolean(array('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'] = Util_Environment::host();
$engineConfig['instance_id'] = Util_Environment::instance_id();
$cache[$blog_id] = Cache::instance($engine, $engineConfig);
}
return $cache[$blog_id];
}
开发者ID:eduardodomingos,项目名称:eduardodomingos.com,代码行数:38,代码来源:Extension_FragmentCache_WpObjectCache.php
示例5: _get_cache
/**
* Returns cache object
*
* @return W3_Cache_Base
*/
function _get_cache()
{
static $cache = null;
if (is_null($cache)) {
$engine = $this->_config->get_string('pgcache.engine');
switch ($engine) {
case 'memcached':
$engineConfig = array('servers' => $this->_config->get_array('pgcache.memcached.servers'), 'persistent' => $this->_config->get_boolean('pgcache.memcached.persistent'), 'aws_autodiscovery' => $this->_config->get_boolean('pgcache.memcached.aws_autodiscovery'), 'username' => $this->_config->get_boolean('pgcache.memcached.username'), 'password' => $this->_config->get_boolean('pgcache.memcached.password'));
break;
case 'redis':
$engineConfig = array('servers' => $this->_config->get_array('pgcache.redis.servers'), 'persistent' => $this->_config->get_boolean('pgcache.redis.persistent'), 'dbid' => $this->_config->get_boolean('pgcache.redis.dbid'), 'password' => $this->_config->get_boolean('pgcache.redis.password'));
break;
case 'file':
$engineConfig = array('section' => 'page', 'flush_parent' => Util_Environment::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 (Util_Environment::blog_id() == 0) {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR;
} else {
$flush_dir = W3TC_CACHE_PAGE_ENHANCED_DIR . '/' . Util_Environment::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'] = '';
// host is always put to a key
$engineConfig['instance_id'] = Util_Environment::instance_id();
$cache = Cache::instance($engine, $engineConfig);
}
return $cache;
}