本文整理汇总了PHP中opcache_reset函数的典型用法代码示例。如果您正苦于以下问题:PHP opcache_reset函数的具体用法?PHP opcache_reset怎么用?PHP opcache_reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opcache_reset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ___wp_sharks_core_rv_on_upgrader_process_complete__on_shutdown
/**
* Flush the OPcache whenever an upgrade occurs.
*
* @since 160620 Adding support for OPcache flushing.
*/
function ___wp_sharks_core_rv_on_upgrader_process_complete__on_shutdown()
{
// NOTE: Avoid relying on objects in the shutdown phase.
// PHP's shutdown phase is known to destruct objects randomly.
if (function_exists('opcache_reset')) {
@opcache_reset();
}
}
示例2: purgeOPcache
public function purgeOPcache()
{
if (!extension_loaded('Zend OPcache')) {
return;
}
opcache_reset();
}
示例3: opcacheReset
/**
* Reset opcache.
*
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function opcacheReset(Request $request)
{
if ('127.0.0.1' === $request->ip()) {
opcache_reset();
}
return response()->json('', 200);
}
示例4: 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;
}
示例5: handle
/**
* Resets the opcache if it is available on the server and if we are not on a production server. This can be very
* useful for you are working locally and you don't want to deal with cached responses from the server. This
* feature is excluded from production environments since it is typically desired to use as much caching as
* possible in order to improve the user experience
*
* @param $request
* @param callable $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (env('APP_ENV') != 'production' && function_exists('opcache_reset')) {
opcache_reset();
}
return $next($request);
}
示例6: setTimestamp
public static function setTimestamp($value = null)
{
if (function_exists('\\opcache_reset')) {
\opcache_reset();
}
return $value;
}
示例7: 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);
}
};
}
}
示例8: purge
/**
* {@inheritDoc}
*/
function purge()
{
// Purge all phpbb cache files
try {
$iterator = new \DirectoryIterator($this->cache_dir);
} catch (\Exception $e) {
return;
}
foreach ($iterator as $fileInfo) {
if ($fileInfo->isDot()) {
continue;
}
$filename = $fileInfo->getFilename();
if ($fileInfo->isDir()) {
$this->remove_dir($fileInfo->getPathname());
} else {
if (strpos($filename, 'container_') === 0 || strpos($filename, 'url_matcher') === 0 || strpos($filename, 'sql_') === 0 || strpos($filename, 'data_') === 0) {
$this->remove_file($fileInfo->getPathname());
}
}
}
unset($this->vars);
unset($this->sql_rowset);
unset($this->sql_row_pointer);
if (function_exists('opcache_reset')) {
@opcache_reset();
}
$this->vars = array();
$this->sql_rowset = array();
$this->sql_row_pointer = array();
$this->is_modified = false;
}
示例9: __construct
/**
* Constructor.
*/
public function __construct()
{
if (function_exists('opcache_reset')) {
opcache_reset();
}
$this->config = file_exists($this->configFile);
}
示例10: __construct
public function __construct(Application $app)
{
$this->app = $app;
if (function_exists('opcache_reset')) {
opcache_reset();
}
$this->config = file_exists($this->configFile);
}
示例11: onStart
/**
* 当socket服务启动时,回调此方法
*/
public static function onStart()
{
echo 'swoole start, swoole version: ' . SWOOLE_VERSION . PHP_EOL;
//FIXME 完善opcode 清理功能
if (extension_loaded('Zend OPcache')) {
opcache_reset();
}
}
示例12: main
public function main()
{
if (opcache_reset()) {
$this->success('Opcache clear complete');
} else {
$this->err("Error : Opcache clear failed");
}
}
示例13: export
protected function export()
{
$fileData = '<?php ' . "\n return " . var_export($this->_activePlugins, true) . ';';
file_put_contents($this->configFile, $fileData);
if (function_exists('opcache_reset')) {
opcache_reset();
}
}
示例14: reset_call
public function reset_call()
{
if (isset($_POST['opcache_reset'])) {
opcache_reset();
error_log('OP Cache Reset call made');
}
die;
}
示例15: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->app->environment() != 'production') {
if (function_exists('opcache_reset')) {
opcache_reset();
}
}
return $next($request);
}