From 9ff568bdd3929ec7ee4670a957b761c40118a833 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 28 Sep 2021 14:15:48 -0500 Subject: [PATCH] formatting --- src/Swoole/Handlers/OnWorkerStart.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Swoole/Handlers/OnWorkerStart.php b/src/Swoole/Handlers/OnWorkerStart.php index 64cef5e78..ea2d6c3ac 100644 --- a/src/Swoole/Handlers/OnWorkerStart.php +++ b/src/Swoole/Handlers/OnWorkerStart.php @@ -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']; @@ -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(); }