本文整理汇总了PHP中eaccelerator_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP eaccelerator_clear函数的具体用法?PHP eaccelerator_clear怎么用?PHP eaccelerator_clear使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eaccelerator_clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clean
public function clean()
{
eaccelerator_clean();
eaccelerator_clear();
eaccelerator_gc();
eaccelerator_purge();
return;
}
示例2: flush
public function flush()
{
$v9b207167e5381c47682c6b4f58a623fb = eaccelerator_clear();
$v14f802e1fba977727845e8872c1743a7 = eaccelerator_list_keys();
foreach ($v14f802e1fba977727845e8872c1743a7 as $v3c6e0b8a9c15224a8228b9a98ca1531d) {
eaccelerator_rm(substr($v3c6e0b8a9c15224a8228b9a98ca1531d['name'], 1));
}
return $v9b207167e5381c47682c6b4f58a623fb;
}
示例3: initialize
/**
* Initialize the cache properties
*/
protected static function initialize()
{
$apcVersion = phpversion('apc');
$xcVersion = phpversion('xcache');
static::$supportedCaches = array('OPcache' => array('active' => extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1', 'version' => phpversion('Zend OPcache'), 'canReset' => TRUE, 'canInvalidate' => function_exists('opcache_invalidate'), 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
if ($fileAbsPath !== NULL && function_exists('opcache_invalidate')) {
opcache_invalidate($fileAbsPath);
} else {
opcache_reset();
}
}), 'APC' => array('active' => extension_loaded('apc') && !extension_loaded('apcu') && ini_get('apc.enabled') === '1', 'version' => $apcVersion, 'canReset' => TRUE, 'canInvalidate' => self::canApcInvalidate(), 'error' => $apcVersion && VersionNumberUtility::convertVersionNumberToInteger($apcVersion) < 3001007, 'clearCallback' => function ($fileAbsPath) {
if ($fileAbsPath !== NULL && OpcodeCacheUtility::getCanInvalidate('APC')) {
// This may output a warning like: PHP Warning: apc_delete_file(): Could not stat file
// This warning isn't true, this means that apc was unable to generate the cache key
// which depends on the configuration of APC.
apc_delete_file($fileAbsPath);
} else {
apc_clear_cache('opcode');
}
}), 'WinCache' => array('active' => extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1', 'version' => phpversion('wincache'), 'canReset' => FALSE, 'canInvalidate' => TRUE, 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
if ($fileAbsPath !== NULL) {
wincache_refresh_if_changed(array($fileAbsPath));
} else {
// No argument means refreshing all.
wincache_refresh_if_changed();
}
}), 'XCache' => array('active' => extension_loaded('xcache'), 'version' => $xcVersion, 'canReset' => TRUE, 'canInvalidate' => FALSE, 'error' => FALSE, 'clearCallback' => $xcVersion && VersionNumberUtility::convertVersionNumberToInteger($xcVersion) < 3000000 ? function ($fileAbsPath) {
if (!ini_get('xcache.admin.enable_auth')) {
xcache_clear_cache(XC_TYPE_PHP, 0);
}
} : function ($fileAbsPath) {
if (!ini_get('xcache.admin.enable_auth')) {
xcache_clear_cache(XC_TYPE_PHP);
}
}), 'eAccelerator' => array('active' => extension_loaded('eAccelerator'), 'version' => phpversion('eaccelerator'), 'canReset' => FALSE, 'canInvalidate' => FALSE, 'error' => TRUE, 'clearCallback' => function ($fileAbsPath) {
eaccelerator_clear();
}), 'ZendOptimizerPlus' => array('active' => extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable') === '1', 'version' => phpversion('Zend Optimizer+'), 'canReset' => TRUE, 'canInvalidate' => FALSE, 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
accelerator_reset();
}));
static::$activeCaches = array();
// Cache the active ones
foreach (static::$supportedCaches as $opcodeCache => $properties) {
if ($properties['active']) {
static::$activeCaches[$opcodeCache] = $properties;
}
}
}
示例4: initialize
/**
* Initialize the cache properties
*
* @return void
*/
protected static function initialize()
{
$apcVersion = phpversion('apc');
$xcVersion = phpversion('xcache');
static::$supportedCaches = array('OPcache' => array('active' => extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1', 'version' => phpversion('Zend OPcache'), 'canReset' => true, 'canInvalidate' => function_exists('opcache_invalidate'), 'error' => false, 'clearCallback' => function ($fileAbsPath) {
if ($fileAbsPath !== null && function_exists('opcache_invalidate')) {
opcache_invalidate($fileAbsPath, true);
} else {
opcache_reset();
}
}), 'APC' => array('active' => extension_loaded('apc') && !extension_loaded('apcu') && ini_get('apc.enabled') === '1', 'version' => $apcVersion, 'canReset' => true, 'canInvalidate' => self::canApcInvalidate(), 'error' => $apcVersion && version_compare($apcVersion, '3.1.7', '<'), 'clearCallback' => function ($fileAbsPath) {
if ($fileAbsPath !== null && iMSCP_Utility_OpcodeCache::getCanInvalidate('APC')) {
// This may output a warning like: PHP Warning: apc_delete_file(): Could not stat file
// This warning isn't true, this means that apc was unable to generate the cache key
// which depends on the configuration of APC.
@apc_delete_file($fileAbsPath);
} else {
apc_clear_cache('opcode');
}
}), 'XCache' => array('active' => extension_loaded('xcache'), 'version' => $xcVersion, 'canReset' => true, 'canInvalidate' => false, 'error' => false, 'clearCallback' => $xcVersion && version_compare($xcVersion, '3.0.0', '<') ? function () {
if (!ini_get('xcache.admin.enable_auth')) {
xcache_clear_cache(XC_TYPE_PHP, 0);
}
} : function () {
if (!ini_get('xcache.admin.enable_auth')) {
xcache_clear_cache(XC_TYPE_PHP);
}
}), 'eAccelerator' => array('active' => extension_loaded('eAccelerator'), 'version' => phpversion('eaccelerator'), 'canReset' => false, 'canInvalidate' => false, 'error' => false, 'clearCallback' => function () {
eaccelerator_clear();
}), 'ZendOptimizerPlus' => array('active' => extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable') === '1', 'version' => phpversion('Zend Optimizer+'), 'canReset' => true, 'canInvalidate' => false, 'error' => false, 'clearCallback' => function () {
accelerator_reset();
}));
static::$activeCaches = array();
// Cache the active ones
foreach (static::$supportedCaches as $opcodeCache => $properties) {
if ($properties['active']) {
static::$activeCaches[$opcodeCache] = $properties;
}
}
}
示例5: opcache_reset
static function opcache_reset()
{
/**/
if (function_exists('accelerator_reset')) {
accelerator_reset();
}
/**/
if (function_exists('apc_clear_cache')) {
apc_clear_cache('opcode');
}
/**/
if (function_exists('eaccelerator_clear')) {
eaccelerator_clear();
}
/**/
if (function_exists('opcache_reset')) {
opcache_reset();
}
/**/
if (function_exists('wincache_refresh_if_changed')) {
wincache_refresh_if_changed();
}
return true;
}
示例6: clear
/**
*/
public function clear()
{
eaccelerator_clear();
}
示例7: clear
public function clear()
{
return @eaccelerator_clear();
}
示例8: clearCache
/**
* Only clears the elements marked for deletion
* i.e. does not perform an unconditional 'clear' of
* all entries.
*/
public function clearCache()
{
return eaccelerator_clear();
}
示例9: flush
public function flush()
{
eaccelerator_gc();
eaccelerator_clear();
eaccelerator_removed_scripts();
}
示例10: clean_cache
/**
* Empty out the cache in use as best it can
*
* It may only remove the files of a certain type (if the $type parameter is given)
* Type can be user, data or left blank
* - user clears out user data
* - data clears out system / opcode data
* - If no type is specified will perfom a complete cache clearing
* For cache engines that do not distinguish on types, a full cache flush will be done
*
* @param string $type = ''
*/
function clean_cache($type = '')
{
global $cache_accelerator, $cache_uid, $cache_password, $cache_memcached, $memcached;
switch ($cache_accelerator) {
case 'memcached':
if ((function_exists('memcache_flush') || function_exists('memcached_flush')) && !empty($cache_memcached)) {
// Not connected yet?
if (empty($memcached)) {
get_memcached_server();
}
if (!$memcached) {
return;
}
// Clear it out, really invalidate whats there
if (function_exists('memcache_flush')) {
memcache_flush($memcached);
} else {
memcached_flush($memcached);
}
}
break;
case 'eaccelerator':
if (function_exists('eaccelerator_clear') && function_exists('eaccelerator_clean')) {
// Clean out the already expired items
@eaccelerator_clean();
// Remove all unused scripts and data from shared memory and disk cache,
// e.g. all data that isn't used in the current requests.
@eaccelerator_clear();
}
case 'mmcache':
if (function_exists('mmcache_gc')) {
// Removes all expired keys from shared memory, this is not a complete cache flush :(
// @todo there is no clear function, should we try to find all of the keys and delete those? with mmcache_rm
mmcache_gc();
}
break;
case 'apc':
case 'apcu':
if (function_exists('apc_clear_cache')) {
// If passed a type, clear that type out
if ($type === '' || $type === 'data') {
apc_clear_cache('user');
apc_clear_cache('system');
} elseif ($type === 'user') {
apc_clear_cache('user');
}
}
break;
case 'zend':
if (function_exists('zend_shm_cache_clear')) {
zend_shm_cache_clear('ELK');
}
break;
case 'xcache':
if (function_exists('xcache_clear_cache') && function_exists('xcache_count')) {
// Xcache may need auth credentials, depending on how its been set up
if (!empty($cache_uid) && !empty($cache_password)) {
$_SERVER['PHP_AUTH_USER'] = $cache_uid;
$_SERVER['PHP_AUTH_PW'] = $cache_password;
}
// Get the counts so we clear each instance
$pcnt = xcache_count(XC_TYPE_PHP);
$vcnt = xcache_count(XC_TYPE_VAR);
// Time to clear the user vars and/or the opcache
if ($type === '' || $type === 'user') {
for ($i = 0; $i < $vcnt; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
}
if ($type === '' || $type === 'data') {
for ($i = 0; $i < $pcnt; $i++) {
xcache_clear_cache(XC_TYPE_PHP, $i);
}
}
}
break;
}
// To be complete, we also clear out the cache dir so we get any js/css hive files
if (is_dir(CACHEDIR)) {
// Remove the cache files in our disk cache directory
$dh = opendir(CACHEDIR);
while ($file = readdir($dh)) {
if ($file != '.' && $file != '..' && $file != 'index.php' && $file != '.htaccess' && (!$type || substr($file, 0, strlen($type)) == $type)) {
@unlink(CACHEDIR . '/' . $file);
}
}
closedir($dh);
}
//.........这里部分代码省略.........
示例11: resetCache
public function resetCache()
{
eaccelerator_clear();
}
示例12: cleanOpcodes
/**
* Try to reset any opcode caches we know about
*
* @todo make it so developers can extend this somehow
*/
public static function cleanOpcodes()
{
// APC
if (function_exists('apc_clear_cache') && ini_get('apc.stat') == 0) {
apc_clear_cache();
}
// Wincache
if (function_exists('wincache_refresh_if_changed')) {
wincache_refresh_if_changed();
}
// Zend
if (function_exists('accelerator_reset')) {
accelerator_reset();
}
// eAccelerator
if (function_exists('eaccelerator_clear')) {
eaccelerator_clear();
}
// XCache
if (function_exists('xcache_clear_cache') && !ini_get('xcache.admin.enable_auth')) {
$max = xcache_count(XC_TYPE_PHP);
for ($i = 0; $i < $max; $i++) {
if (!xcache_clear_cache(XC_TYPE_PHP, $i)) {
break;
}
}
}
}
示例13: eaccelerator_caching
if (isset($_POST['caching'])) {
if ($info['cache']) {
eaccelerator_caching(false);
} else {
eaccelerator_caching(true);
}
} else {
if (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) {
if ($info['optimizer']) {
eaccelerator_optimizer(false);
} else {
eaccelerator_optimizer(true);
}
} else {
if (isset($_POST['clear'])) {
eaccelerator_clear();
} else {
if (isset($_POST['clean'])) {
eaccelerator_clean();
} else {
if (isset($_POST['purge'])) {
eaccelerator_purge();
}
}
}
}
}
$info = eaccelerator_info();
/* }}} */
/* {{{ create_script_table */
function create_script_table($list)
示例14: globalcache_clear
/**
* Empty the whole cache.
*
* @return bool true if ok, false on error
*/
function globalcache_clear()
{
if (!hook_already_fired(HOOK_POST_INIT)) {
return false;
}
global $CONFIG;
switch ($CONFIG['globalcache']['CACHE']) {
case globalcache_CACHE_OFF:
return true;
break;
case globalcache_CACHE_APC:
return apc_clear_cache('user');
break;
case globalcache_CACHE_ZEND:
return $GLOBALS["zend_cache_object"]->clean();
break;
case globalcache_CACHE_EACCELERATOR:
return eaccelerator_clear();
break;
case globalcache_CACHE_MEMCACHE:
return $GLOBALS["memcache_object"]->flush();
break;
case globalcache_CACHE_DB:
$ds = model_datasource($CONFIG['globalcache']['datasource']);
try {
$ds->ExecuteSql("DELETE FROM wdf_cache");
} catch (Exception $ex) {
}
break;
}
return false;
}
示例15: flush
/**
* Flush cache
*
* @return bool
*/
public function flush()
{
@eaccelerator_clean();
@eaccelerator_clear();
return true;
}