本文整理汇总了PHP中CacheEngine类的典型用法代码示例。如果您正苦于以下问题:PHP CacheEngine类的具体用法?PHP CacheEngine怎么用?PHP CacheEngine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CacheEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: make_admin_menu
function make_admin_menu()
{
global $dirs, $futurebb_user, $base_config;
if (!file_exists(FORUM_ROOT . '/app_config/cache/admin_pages.php')) {
CacheEngine::CacheAdminPages();
}
include FORUM_ROOT . '/app_config/cache/admin_pages.php';
?>
<div class="forum_content leftmenu">
<h2 class="boxtitle">Administration</h2>
<ul class="leftnavlist">
<?php
if ($futurebb_user['g_admin_privs']) {
$p = $admin_pages;
} else {
$p = $mod_pages;
}
foreach ($p as $key => $val) {
echo '<li';
if ($dirs[2] == $key) {
echo ' class="active"';
}
echo '><a href="' . $base_config['baseurl'] . '/admin/' . $key . '">' . htmlspecialchars(translate($val)) . '</a></li>';
}
?>
</ul>
</div>
<?php
}
示例2: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @see CacheEngine::__defaults
*/
public function init($settings = array()) {
if (!isset($settings['prefix'])) {
$settings['prefix'] = Inflector::slug(APP_DIR) . '_';
}
$settings += array('engine' => 'Apc');
parent::init($settings);
return function_exists('apc_dec');
}
示例3: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return bool True if the engine has been successfully initialized, false if not
* @see CacheEngine::__defaults
*/
public function init($settings = array())
{
if (!isset($settings['prefix'])) {
$settings['prefix'] = Inflector::slug(APP_DIR) . '_';
}
$settings += array('engine' => 'Apc');
parent::init($settings);
if (function_exists('apcu_dec')) {
$this->_apcExtension = 'apcu';
return true;
}
return function_exists('apc_dec');
}
示例4: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
*/
public function init($settings = array())
{
if (!class_exists('Memcache')) {
return false;
}
if (!isset($settings['prefix'])) {
$settings['prefix'] = Inflector::slug(APP_DIR) . '_';
}
$settings += array('engine' => 'Memcache', 'servers' => array('127.0.0.1'), 'compress' => false, 'persistent' => true);
parent::init($settings);
if ($this->settings['compress']) {
$this->settings['compress'] = MEMCACHE_COMPRESSED;
}
if (is_string($this->settings['servers'])) {
$this->settings['servers'] = array($this->settings['servers']);
}
if (!isset($this->_Memcache)) {
$return = false;
$this->_Memcache = new Memcache();
foreach ($this->settings['servers'] as $server) {
list($host, $port) = $this->_parseServerString($server);
if ($this->_Memcache->addServer($host, $port, $this->settings['persistent'])) {
$return = true;
}
}
return $return;
}
return true;
}
示例5: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings = array())
{
if (!class_exists('Memcache')) {
return false;
}
parent::init($settings);
$defaults = array('servers' => array('127.0.0.1'), 'compress' => false);
$this->settings = array_merge($this->settings, $defaults, $settings);
if ($this->settings['compress']) {
$this->settings['compress'] = MEMCACHE_COMPRESSED;
}
if (!is_array($this->settings['servers'])) {
$this->settings['servers'] = array($this->settings['servers']);
}
$this->__Memcache =& new Memcache();
foreach ($this->settings['servers'] as $server) {
$parts = explode(':', $server);
$host = $parts[0];
$port = 11211;
if (isset($parts[1])) {
$port = $parts[1];
}
if ($this->__Memcache->addServer($host, $port)) {
return true;
}
}
return false;
}
示例6: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings) {
parent::init(array_merge(array(
'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'
), $settings)
);
return function_exists('xcache_info');
}
示例7: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings = array())
{
if (!class_exists('Memcache')) {
return false;
}
parent::init(array_merge(array('engine' => 'Memcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'servers' => array('127.0.0.1'), 'compress' => false), $settings));
if ($this->settings['compress']) {
$this->settings['compress'] = MEMCACHE_COMPRESSED;
}
if (!is_array($this->settings['servers'])) {
$this->settings['servers'] = array($this->settings['servers']);
}
if (!isset($this->__Memcache)) {
$return = false;
$this->__Memcache =& new Memcache();
foreach ($this->settings['servers'] as $server) {
$parts = explode(':', $server);
$host = $parts[0];
$port = 11211;
if (isset($parts[1])) {
$port = $parts[1];
}
if ($this->__Memcache->addServer($host, $port)) {
$return = true;
}
}
return $return;
}
return true;
}
示例8: init
/**
* Initialize the cache engine
*
* Called automatically by the cache frontend
*
* @param array $params Associative array of parameters for the engine
* @return boolean true if the engine has been succesfully initialized, false if not
* @access public
*/
function init($settings = array()) {
if (!function_exists('eaccelerator_put')) {
return false;
}
return parent::init(array_merge(array('engine' => 'Eaccelerator', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings));
}
示例9: init
public function init($settings = array())
{
$settings += array('engine' => 'DbTable', 'storage' => 'cache_db', 'prefix' => '', 'duration' => false, 'serialize' => true);
parent::init($settings);
$this->model = new DbCache(false, $this->settings['storage']);
return true;
}
示例10: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings)
{
parent::init($settings);
$defaults = array('PHP_AUTH_USER' => 'cake', 'PHP_AUTH_PW' => 'cake');
$this->settings = am($this->settings, $defaults, $settings);
return function_exists('xcache_info');
}
示例11: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return bool True if the engine has been successfully initialized, false if not
*/
public function init($settings = [])
{
if (!class_exists('Memcached')) {
return false;
}
if (!isset($settings['prefix'])) {
$settings['prefix'] = Inflector::slug(APP_DIR) . '_';
}
$settings += ['engine' => 'Memcached', 'servers' => ['127.0.0.1'], 'compress' => false, 'persistent' => true];
parent::init($settings);
$this->_keys .= $this->settings['prefix'];
if (!is_array($this->settings['servers'])) {
$this->settings['servers'] = [$this->settings['servers']];
}
if (!isset($this->_Memcached)) {
$return = false;
$this->_Memcached = new Memcached($this->settings['persistent'] ? 'mc' : null);
$this->_setOptions();
if (!count($this->_Memcached->getServerList())) {
$servers = [];
foreach ($this->settings['servers'] as $server) {
$servers[] = $this->_parseServerString($server);
}
if ($this->_Memcached->addServers($servers)) {
$return = true;
}
}
if (!$this->_Memcached->get($this->_keys)) {
$this->_Memcached->set($this->_keys, '');
}
return $return;
}
return true;
}
示例12: init
function init($settings = array())
{
parent::init(array_merge(array('engine' => 'SuperStack', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings));
foreach ($settings['stack'] as $key => $stack) {
Cache::config($key, $stack);
}
return true;
}
示例13: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return bool True if the engine has been successfully initialized, false if not
*/
public function init($settings = array())
{
if (php_sapi_name() !== 'cli') {
parent::init(array_merge(array('engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'), $settings));
return function_exists('xcache_info');
}
return false;
}
示例14: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
*/
public function init($settings = array())
{
if (!class_exists('Redis')) {
return false;
}
parent::init(array_merge(array('engine' => 'Redis', 'prefix' => null, 'server' => '127.0.0.1', 'port' => 6379, 'password' => false, 'timeout' => 0, 'persistent' => true), $settings));
return $this->_connect();
}
示例15: init
/**
* Initialize the Cache Engine
*
* Called automatically by the cache frontend
* To reinitialize the settings call Cache::engine('EngineName', [optional] settings = array());
*
* @param array $settings array of setting for the engine
* @return bool True if the engine has been successfully initialized, false if not
*/
public function init($settings = array())
{
if (!class_exists('Redis')) {
return false;
}
parent::init(array_merge(array('engine' => 'Redis', 'prefix' => Inflector::slug(APP_DIR) . '_', 'server' => '127.0.0.1', 'database' => 0, 'port' => 6379, 'password' => false, 'timeout' => 0, 'persistent' => true, 'unix_socket' => false), $settings));
return $this->_connect();
}