本文整理汇总了PHP中apcu_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP apcu_clear_cache函数的具体用法?PHP apcu_clear_cache怎么用?PHP apcu_clear_cache使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apcu_clear_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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");
}
示例2: clear
public function clear()
{
if ($this->apcu) {
return apcu_clear_cache();
}
return apc_clear_cache();
}
示例3: clearApc
public static function clearApc()
{
if (function_exists('apcu_clear_cache')) {
apcu_clear_cache();
}
return true;
}
示例4: reset
public function reset()
{
try {
apcu_clear_cache();
} catch (\Exception $e) {
\Dsc\System::addMessage($e->getMessage(), 'error');
}
$this->app->reroute('/admin/cache/apcu');
}
示例5: setUp
/**
* @requires extension apcu
*/
protected function setUp()
{
if (!extension_loaded('apcu')) {
$this->markTestSkipped('apcu extension not installed');
}
if ((bool) ini_get('apc.enable_cli') === false) {
$this->markTestSkipped('apcu extension not enabled for CLI');
}
apcu_clear_cache();
parent::setUp();
}
示例6: clear
public function clear($id = null)
{
if ($id === null) {
if (apcu_clear_cache()) {
return true;
}
} else {
if (apcu_delete($id)) {
return true;
}
}
return false;
}
示例7: doFlush
/**
* {@inheritdoc}
*/
protected function doFlush()
{
return apcu_clear_cache() && apcu_clear_cache('user');
}
示例8: clear
/**
* {@inheritdoc}
*/
public function clear()
{
return apcu_clear_cache();
}
示例9: createEntityManager
/**
* Factory method for Doctrine EntityManager
*
* @todo add other caching drivers (memcache, xcache)
* @todo put into static class? singleton? function or state class?
*/
public static function createEntityManager($admin = FALSE)
{
$config = new ORM\Configuration();
if (Util\Configuration::read('devmode') == FALSE) {
$cache = null;
if (extension_loaded('apcu')) {
$cache = new Cache\ApcuCache();
}
if ($cache) {
$config->setMetadataCacheImpl($cache);
$config->setQueryCacheImpl($cache);
}
} else {
if (extension_loaded('apcu')) {
// clear cache
apcu_clear_cache('user');
}
}
$driverImpl = $config->newDefaultAnnotationDriver(VZ_DIR . '/lib/Model');
$config->setMetadataDriverImpl($driverImpl);
$config->setProxyDir(VZ_DIR . '/lib/Model/Proxy');
$config->setProxyNamespace('Volkszaehler\\Model\\Proxy');
$config->setAutoGenerateProxyClasses(Util\Configuration::read('devmode'));
$dbConfig = Util\Configuration::read('db');
if ($admin && isset($dbConfig['admin'])) {
$dbConfig = array_merge($dbConfig, $dbConfig['admin']);
}
return ORM\EntityManager::create($dbConfig, $config);
}
示例10: clear_cache
/**
* Clears all cached data.
*
* @return bool
*/
function clear_cache()
{
\clearstatcache();
if (\extension_loaded('apcu')) {
\apcu_clear_cache();
}
$dirs = ['comments', 'csp_hash', 'csp_static', 'html_purifier', 'markdown', 'static'];
foreach ($dirs as $dir) {
if (!\is_dir($dir)) {
\mkdir($dir, 0775, true);
continue;
}
foreach (\Airship\list_all_files(ROOT . '/tmp/cache/' . $dir) as $f) {
if (\is_dir($f)) {
continue;
}
if (\preg_match('#/([0-9a-z]+)$#', $f)) {
\unlink($f);
}
}
}
// Nuke the Twig cache separately:
foreach (\Airship\list_all_files(ROOT . '/tmp/cache/twig') as $f) {
if (\is_dir($f)) {
continue;
}
if (\preg_match('#/([0-9a-z]+).php$#', $f)) {
\unlink($f);
}
}
foreach (\glob(ROOT . '/tmp/cache/*.json') as $file) {
\unlink($file);
}
\clearstatcache();
return true;
}
示例11: tearDown
protected function tearDown()
{
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
apcu_clear_cache();
}
}
示例12: flush
public function flush()
{
return $this->apcu ? apcu_clear_cache() : apc_clear_cache('user');
}
示例13: apcu_clear_cache
echo <<<EOB
\t\t\t\t<html><body>
\t\t\t\t<h1>Rejected!</h1>
\t\t\t\t<big>Wrong Username or Password!</big><br/> <br/>
\t\t\t\t<big><a href='{$PHP_SELF}?OB={$MYREQUEST['OB']}'>Continue...</a></big>
\t\t\t\t</body></html>
EOB;
exit;
} else {
$AUTHENTICATED = 1;
}
}
}
// clear cache
if ($AUTHENTICATED && isset($MYREQUEST['CC']) && $MYREQUEST['CC']) {
apcu_clear_cache();
}
if ($AUTHENTICATED && !empty($MYREQUEST['DU'])) {
apcu_delete($MYREQUEST['DU']);
}
if (!function_exists('apcu_cache_info')) {
echo "No cache info available. APC does not appear to be running.";
exit;
}
$cache = apcu_cache_info();
$mem = apcu_sma_info();
// don't cache this page
//
header("Cache-Control: no-store, no-cache, must-revalidate");
// HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
示例14: doClear
/**
* {@inheritdoc}
*/
protected function doClear()
{
return apcu_clear_cache();
}
示例15: flush
/**
* Remove all items from the cache.
*
* @return void
*/
public function flush()
{
$this->isApcUEnabled ? apcu_clear_cache() : apc_clear_cache('user');
}