From: Philipp Holzer Date: Thu, 26 Sep 2019 16:14:36 +0000 (+0200) Subject: code optimization X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dc73117a62990b21eb71cdce95446b3d58fde20b;p=friendica.git code optimization --- diff --git a/src/Core/Cache/TraitMemcacheCommand.php b/src/Core/Cache/TraitMemcacheCommand.php index 2b136621e5..0bbab79b25 100644 --- a/src/Core/Cache/TraitMemcacheCommand.php +++ b/src/Core/Cache/TraitMemcacheCommand.php @@ -44,16 +44,14 @@ trait TraitMemcacheCommand foreach ($lines as $line) { - if (preg_match("/STAT items:([\d]+):number ([\d]+)/", $line, $matches)) { - - if (isset($matches[1])) { - if (!in_array($matches[1], $keys)) { - $slabs[] = $matches[1]; - $string = $this->sendMemcacheCommand("stats cachedump " . $matches[1] . " " . $matches[2]); - preg_match_all("/ITEM (.*?) /", $string, $matches); - $keys = array_merge($keys, $matches[1]); - } - } + if (preg_match("/STAT items:([\d]+):number ([\d]+)/", $line, $matches) && + isset($matches[1]) && + !in_array($matches[1], $keys)) { + + $slabs[] = $matches[1]; + $string = $this->sendMemcacheCommand("stats cachedump " . $matches[1] . " " . $matches[2]); + preg_match_all("/ITEM (.*?) /", $string, $matches); + $keys = array_merge($keys, $matches[1]); } } @@ -83,7 +81,7 @@ trait TraitMemcacheCommand fwrite($s, $command . "\r\n"); $buf = ''; - while ((!feof($s))) { + while (!feof($s)) { $buf .= fgets($s, 256);