]> git.mxchange.org Git - friendica.git/commitdiff
code optimization
authorPhilipp Holzer <admin+github@philipp.info>
Thu, 26 Sep 2019 16:14:36 +0000 (18:14 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Mon, 30 Sep 2019 12:03:15 +0000 (14:03 +0200)
src/Core/Cache/TraitMemcacheCommand.php

index 2b136621e59aac084f59fb092f12766bd2bc1f29..0bbab79b254c290d973f6603ad7c7c7b20be2ad5 100644 (file)
@@ -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);