Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 28, 2021
1 parent 9ffa49c commit 9ff568b
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/Swoole/Handlers/OnWorkerStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __invoke($server, int $workerId)

$this->dispatchServerTickTaskEverySecond($server);
$this->streamRequestsToConsole($server);
$this->clearCache();
$this->clearOpcodeCache();

if ($this->shouldSetProcessName) {
$isTaskWorker = $workerId >= $server->setting['worker_num'];
Expand Down Expand Up @@ -112,18 +112,13 @@ protected function streamRequestsToConsole($server)
}

/**
* Clear the cache of APCu and Opcache.
* Clear the APCu and Opcache caches.
*
* @return void
*/
protected function clearCache()
protected function clearOpcodeCache()
{
static $functions = [
'apcu_clear_cache',
'opcache_reset',
];

foreach ($functions as $function) {
foreach (['apcu_clear_cache', 'opcache_reset'] as $function) {
if (function_exists($function)) {
$function();
}
Expand Down

0 comments on commit 9ff568b

Please sign in to comment.