当前位置: 首页>>代码示例>>PHP>>正文


PHP xcache_clear_cache函数代码示例

本文整理汇总了PHP中xcache_clear_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP xcache_clear_cache函数的具体用法?PHP xcache_clear_cache怎么用?PHP xcache_clear_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了xcache_clear_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clear

 public function clear()
 {
     if (!_cacheStatus) {
         return FALSE;
     }
     xcache_clear_cache(XC_TYPE_VAR, 0);
 }
开发者ID:no2key,项目名称:ZanPHP,代码行数:7,代码来源:xcache.php

示例2: initialize

 /**
  * Initialize the ClearCache-Callbacks
  *
  * @return void
  */
 protected static function initialize()
 {
     self::$clearCacheCallbacks = array();
     // Zend OpCache (built in by default since PHP 5.5) - http://php.net/manual/de/book.opcache.php
     if (extension_loaded('Zend OPcache') && ini_get('opcache.enable') === '1') {
         self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) {
             if ($absolutePathAndFilename !== null && function_exists('opcache_invalidate')) {
                 opcache_invalidate($absolutePathAndFilename);
             } else {
                 opcache_reset();
             }
         };
     }
     // WinCache - http://www.php.net/manual/de/book.wincache.php
     if (extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1') {
         self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) {
             if ($absolutePathAndFilename !== null) {
                 wincache_refresh_if_changed(array($absolutePathAndFilename));
             } else {
                 // Refresh everything!
                 wincache_refresh_if_changed();
             }
         };
     }
     // XCache - http://xcache.lighttpd.net/
     // Supported in version >= 3.0.1
     if (extension_loaded('xcache')) {
         self::$clearCacheCallbacks[] = function ($absolutePathAndFilename) {
             // XCache can only be fully cleared.
             if (!ini_get('xcache.admin.enable_auth')) {
                 xcache_clear_cache(XC_TYPE_PHP);
             }
         };
     }
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:40,代码来源:OpcodeCacheHelper.php

示例3: clear

 public function clear()
 {
     $admin = ini_get('xcache.admin.enable_auth') === "On";
     if ($admin && (!isset($this->config['username']) || !isset($this->config['password']))) {
         return false;
     }
     $credentials = array();
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         $credentials['username'] = $_SERVER['PHP_AUTH_USER'];
         $_SERVER['PHP_AUTH_USER'] = $this->config['username'];
     }
     if (isset($_SERVER['PHP_AUTH_PW'])) {
         $credentials['password'] = $_SERVER['PHP_AUTH_PW'];
         $_SERVER['PHP_AUTH_PW'] = $this->config['pass'];
     }
     for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
         if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
             return false;
         }
     }
     if (isset($_SERVER['PHP_AUTH_USER'])) {
         $_SERVER['PHP_AUTH_USER'] = $credentials['username'];
     }
     if (isset($_SERVER['PHP_AUTH_PW'])) {
         $_SERVER['PHP_AUTH_PW'] = $credentials['password'];
     }
     return true;
 }
开发者ID:pavlyshyn,项目名称:cache,代码行数:28,代码来源:XCache.php

示例4: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $cleared = true;
     // Set XCache password
     $tempUsername = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : false;
     $tempPassword = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : false;
     $_SERVER['PHP_AUTH_USER'] = $this->username;
     $_SERVER['PHP_AUTH_PW'] = $this->password;
     // Clear Cache
     $cacheCount = xcache_count(XC_TYPE_VAR);
     for ($i = 0; $i < $cacheCount; $i++) {
         if (@xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
             $cleared = false;
             break;
         }
     }
     // Reset PHP_AUTH username/password
     if ($tempUsername !== false) {
         $_SERVER['PHP_AUTH_USER'] = $tempUsername;
     } else {
         unset($_SERVER['PHP_AUTH_USER']);
     }
     if ($tempPassword !== false) {
         $_SERVER['PHP_AUTH_PW'] = $tempPassword;
     } else {
         unset($_SERVER['PHP_AUTH_PW']);
     }
     // Return result
     return $cleared;
 }
开发者ID:rafaelharus,项目名称:framework,代码行数:33,代码来源:XCache.php

示例5: getAllActive

 /**
  * Returns all supported and active opcaches
  *
  * @return array Array filled with supported and active opcaches
  */
 public function getAllActive()
 {
     $xcVersion = phpversion('xcache');
     $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();
         }
     }), 'WinCache' => array('active' => extension_loaded('wincache') && ini_get('wincache.ocenabled') === '1', 'version' => phpversion('wincache'), 'canReset' => TRUE, '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' => !ini_get('xcache.admin.enable_auth'), 'canInvalidate' => FALSE, 'error' => FALSE, 'clearCallback' => function ($fileAbsPath) {
         if (!ini_get('xcache.admin.enable_auth')) {
             xcache_clear_cache(XC_TYPE_PHP);
         }
     }));
     $activeCaches = array();
     foreach ($supportedCaches as $opcodeCache => $properties) {
         if ($properties['active']) {
             $activeCaches[$opcodeCache] = $properties;
         }
     }
     return $activeCaches;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:34,代码来源:OpcodeCacheService.php

示例6: clear

 public function clear()
 {
     if (!CACHE_STATUS) {
         return false;
     }
     xcache_clear_cache(XC_TYPE_VAR, 0);
 }
开发者ID:jgianpiere,项目名称:ZanPHP,代码行数:7,代码来源:xcache.php

示例7: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     if (ini_get('xcache.admin.enable_auth')) {
         throw new \BadMethodCallException('To use all features of \\Moust\\Silex\\Cache\\XcacheCache, you must set "xcache.admin.enable_auth" to "Off" in your php.ini.');
     }
     return xcache_clear_cache(XC_TYPE_VAR, 0);
 }
开发者ID:GreGosPhaTos,项目名称:silex-cache-service-provider,代码行数:10,代码来源:XcacheCache.php

示例8: delete

 public function delete($id, $tag = FALSE)
 {
     if ($tag !== FALSE) {
         Kohana::log('error', 'Cache: tags are unsupported by the Xcache driver');
         return TRUE;
     } elseif ($id !== TRUE) {
         if (xcache_isset($id)) {
             return xcache_unset($id);
         }
         return FALSE;
     } else {
         // Do the login
         $this->auth();
         $result = TRUE;
         for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
             if (xcache_clear_cache(XC_TYPE_VAR, $i) !== NULL) {
                 $result = FALSE;
                 break;
             }
         }
         // Undo the login
         $this->auth(TRUE);
         return $result;
     }
     return TRUE;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:26,代码来源:Xcache.php

示例9: flush

 /**
  * @return bool
  */
 public function flush()
 {
     $_SERVER["PHP_AUTH_USER"] = "xcache";
     $_SERVER["PHP_AUTH_PW"] = "xcache";
     xcache_clear_cache(XC_TYPE_VAR, 0);
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:10,代码来源:class.ilXcache.php

示例10: tearDown

 public function tearDown()
 {
     if (extension_loaded('xcache') && !ini_get('xcache.admin.enable_auth')) {
         xcache_clear_cache(XC_TYPE_VAR);
     }
     $this->cacheDriver = null;
 }
开发者ID:tlumx,项目名称:framework,代码行数:7,代码来源:XCacheTest.php

示例11: driver_clean

 function driver_clean($option = array())
 {
     $cnt = xcache_count(XC_TYPE_VAR);
     for ($i = 0; $i < $cnt; $i++) {
         xcache_clear_cache(XC_TYPE_VAR, $i);
     }
     return true;
 }
开发者ID:kvox,项目名称:TVSS,代码行数:8,代码来源:xcache.php

示例12: clean

 /**
  * Remove all keys and value from cache
  */
 public function clean()
 {
     $cnt = xcache_count(XC_TYPE_VAR);
     for ($i = 0; $i < $cnt; $i++) {
         xcache_clear_cache(XC_TYPE_VAR, $i);
     }
     return true;
 }
开发者ID:mactronique,项目名称:phpcache,代码行数:11,代码来源:XcacheDriver.php

示例13: doFlush

 /**
  * {@inheritdoc}
  */
 protected function doFlush()
 {
     $this->checkAuthorization();
     
     xcache_clear_cache(XC_TYPE_VAR, 0);
     
     return true;
 }
开发者ID:nresni,项目名称:common,代码行数:11,代码来源:XcacheCache.php

示例14: flush

 public function flush()
 {
     for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
         if (xcache_clear_cache(XC_TYPE_VAR, $i) === false) {
             return false;
         }
     }
     return true;
 }
开发者ID:Bob-586,项目名称:cx_old,代码行数:9,代码来源:xcache.php

示例15: clear_cache

 private function clear_cache()
 {
     $_SERVER["PHP_AUTH_USER"] = "xcache";
     $_SERVER["PHP_AUTH_PW"] = "xcache";
     $xcache_count = xcache_count(XC_TYPE_VAR);
     for ($cacheid = 0; $cacheid < $xcache_count; $cacheid++) {
         xcache_clear_cache(XC_TYPE_VAR, $cacheid);
     }
 }
开发者ID:easthero,项目名称:kohana,代码行数:9,代码来源:auditevent.php


注:本文中的xcache_clear_cache函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。