本文整理汇总了PHP中apc_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP apc_clear_cache函数的具体用法?PHP apc_clear_cache怎么用?PHP apc_clear_cache使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apc_clear_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flushAll
/**
* {@inheritdoc}
*/
public function flushAll()
{
if ($this->currentOnly) {
return apc_clear_cache('user') && apc_clear_cache();
}
$result = true;
foreach ($this->servers as $server) {
if (count(explode('.', $server['ip'])) == 3) {
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
} else {
$socket = socket_create(AF_INET6, SOCK_STREAM, SOL_TCP);
}
// generate the raw http request
$command = sprintf("GET %s HTTP/1.1\r\n", $this->getUrl());
$command .= sprintf("Host: %s\r\n", $server['domain']);
if ($server['basic']) {
$command .= sprintf("Authorization: Basic %s\r\n", $server['basic']);
}
$command .= "Connection: Close\r\n\r\n";
// setup the default timeout (avoid max execution time)
socket_set_option($socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => 2, 'usec' => 0));
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 2, 'usec' => 0));
socket_connect($socket, $server['ip'], $server['port']);
socket_write($socket, $command);
$content = '';
do {
$buffer = socket_read($socket, 1024);
$content .= $buffer;
} while (!empty($buffer));
if ($result) {
$result = substr($content, -2) == 'ok';
}
}
return $result;
}
示例2: clean
public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
{
switch ($mode) {
case Zend_Cache::CLEANING_MODE_ALL:
$ret = true;
if (php_sapi_name() == 'cli') {
$ret = Kwf_Util_Apc::callClearCacheByCli(array('type' => 'user'));
}
if (extension_loaded('apcu')) {
return $ret && apc_clear_cache('user');
} else {
return $ret && apc_clear_cache();
}
break;
case Zend_Cache::CLEANING_MODE_OLD:
$this->_log("Zend_Cache_Backend_Apc::clean() : CLEANING_MODE_OLD is unsupported by the Apc backend");
break;
case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
$this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_APC_BACKEND);
break;
default:
Zend_Cache::throwException('Invalid mode for clean() method');
break;
}
}
示例3: postflight
public function postflight($type, $parent)
{
$this->fixUpdateSite();
// Clear Joomla system cache.
/** @var JCache|JCacheController $cache */
$cache = JFactory::getCache();
$cache->clean('_system');
// Remove all compiled files from APC cache.
if (function_exists('apc_clear_cache')) {
@apc_clear_cache();
}
if ($type == 'uninstall') {
return true;
}
$this->enablePlugin('system', 'kunena');
$this->enablePlugin('quickicon', 'kunena');
$app = JFactory::getApplication();
if (version_compare(JVERSION, '3.0', '>')) {
$modal = <<<EOS
<div id="kunena-modal" class="modal hide fade"><div class="modal-body"></div></div><script>jQuery('#kunena-modal').remove().prependTo('body').modal({backdrop: 'static', keyboard: false, remote: '{$this->makeRoute('index.php?option=com_kunena&view=install&format=raw')}'})</script>
EOS;
} else {
$modal = "<script>window.addEvent('domready',function(){SqueezeBox.open('{$this->makeRoute('index.php?option=com_kunena&view=install&tmpl=component')}',{size:{x:530,y:140},sizeLoading:{x:530,y:140},closable:false,handler:'iframe'});});</script>";
}
$app->enqueueMessage('Installing Kunena... ' . $modal);
return true;
}
示例4: tearDown
/**
* Clean up all.
*/
public function tearDown()
{
if ($this->testSkipped) {
return;
}
apc_clear_cache('user');
}
示例5: clear
/**
* Deletes all items in the pool.
*
* @return boolean
* True if the pool was successfully cleared. False if there was an error.
*/
public function clear()
{
if (function_exists('apcu_clear_cache')) {
return apcu_clear_cache();
}
return apc_clear_cache("user");
}
示例6: testPluginWithMaster
public function testPluginWithMaster()
{
$c = $this->_root->getComponentByClass('Kwf_Component_Plugin_Interface_UseViewCache_Component');
Kwf_Component_Plugin_Interface_UseViewCache_Plugin_Component::$useViewCache = true;
$html1 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$html2 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$html3 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$this->assertEquals($html1, $html2);
$this->assertEquals($html1, $html3);
apc_clear_cache('user');
Kwf_Cache::factory('Core', 'Memcached', array('lifetime' => null, 'automatic_cleaning_factor' => false, 'automatic_serialization' => true))->clean();
Kwf_Cache_Simple::resetZendCache();
Kwf_Component_Plugin_Interface_UseViewCache_Plugin_Component::$useViewCache = false;
$html4 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$html5 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$html6 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$this->assertNotEquals($html3, $html4);
$this->assertNotEquals($html4, $html5);
$this->assertNotEquals($html4, $html6);
$this->assertNotEquals($html5, $html6);
Kwf_Component_Plugin_Interface_UseViewCache_Plugin_Component::$useViewCache = true;
$html7 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$html8 = $c->render(true, true);
Kwf_Component_Plugin_Interface_UseViewCache_Component::$num++;
$this->assertEquals($html7, $html3);
$this->assertEquals($html8, $html3);
}
示例7: clear
/**
* clear static cache with prefix, don't use except in clear-cache-watcher
*
* @internal
*/
public static function clear($cacheIdPrefix)
{
if (extension_loaded('apc')) {
if (PHP_SAPI == 'cli') {
Kwf_Util_Apc::callClearCacheByCli(array('clearCacheSimpleStatic' => $cacheIdPrefix));
} else {
if (!class_exists('APCIterator')) {
throw new Kwf_Exception_NotYetImplemented("We don't want to clear the whole");
} else {
static $prefix;
if (!isset($prefix)) {
$prefix = Kwf_Cache_Simple::getUniquePrefix() . '-';
}
$it = new APCIterator('user', '#^' . preg_quote($prefix . $cacheIdPrefix) . '#', APC_ITER_NONE);
if ($it->getTotalCount() && !$it->current()) {
//APCIterator is borked, delete everything
//see https://bugs.php.net/bug.php?id=59938
if (extension_loaded('apcu')) {
apc_clear_cache();
} else {
apc_clear_cache('user');
}
} else {
//APCIterator seems to work, use it for deletion
apc_delete($it);
}
}
}
} else {
//don't use $cacheIdPrefix as filenames are base64 encoded
foreach (glob('cache/simple/*') as $f) {
unlink($f);
}
}
}
示例8: clear
public function clear()
{
if (!$this->isConnected()) {
return false;
}
return apc_clear_cache('user');
}
示例9: testSaveClear
public function testSaveClear()
{
$x = "valB";
$this->_adapter->saveStatus('AAA', 'BBB', $x);
apc_clear_cache('user');
$this->assertEquals("", $this->_adapter->loadStatus('AAA', 'BBB'));
}
示例10: 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;
}
}
}
}
示例11: _remove_all
function _remove_all()
{
if (!self::$apc_operational) {
return;
}
apc_clear_cache('user');
}
示例12: onAction
/**
*
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$instance = $request->getValueByKey('instance');
$log_clear_type = $request->getValueByKey('log_clear_type');
$value = '';
switch ($instance) {
case 'cache':
CCacheFactory::clearAll();
$value = getMsg("SYS", "MSG_CACHE_CLEARED");
if (APC_EXTENSION_LOADED) {
apc_clear_cache("user");
}
break;
case 'timeline':
modApiFunc('Timeline', 'clearTimeline', $log_clear_type);
$timeline = modApiFunc('Timeline', 'getTimelineRecsCount');
if ($timeline == 0) {
$value = getMsg("SYS", "ADMIN_PHP_FILES_NO_LOG_RECORDS");
} else {
$value = $timeline . getMsg("SYS", "ADMIN_PHP_FILES_LOG_RECORDS");
}
break;
default:
break;
}
return $value;
}
示例13: clear
/**
* Clear the entire cache.
*/
public static function clear()
{
if (Cache::$skip) {
return;
}
apc_clear_cache('user');
}
示例14: tearDown
public function tearDown()
{
unset($this->cassandra);
if (function_exists('apc_clear_cache')) {
apc_clear_cache();
}
}
示例15: clear
public function clear()
{
if ($this->apcu) {
return apcu_clear_cache();
}
return apc_clear_cache();
}