]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache.php
Merge pull request #5862 from nupplaphil/rename_App_Methods
[friendica.git] / src / Core / Cache.php
index ea7807031fde7389479dfb2bad49c1d342094e2c..0fb328aaee8368f86c3e1ec3fbbc2853e453592e 100644 (file)
@@ -51,22 +51,17 @@ class Cache extends \Friendica\BaseObject
        /**
         * @brief Returns all the cache keys sorted alphabetically
         *
-        * @return array|null Null if the driver doesn't support this feature
+        * @param string $prefix Prefix of the keys (optional)
+        *
+        * @return array Empty if the driver doesn't support this feature
         */
-       public static function getAllKeys()
+       public static function getAllKeys($prefix = null)
        {
                $time = microtime(true);
 
-               $return = self::getDriver()->getAllKeys();
-
-               // Keys are prefixed with the node hostname, let's remove it
-               array_walk($return, function (&$value) {
-                       $value = preg_replace('/^' . self::getApp()->get_hostname() . ':/', '', $value);
-               });
-
-               sort($return);
+               $return = self::getDriver()->getAllKeys($prefix);
 
-               self::getApp()->save_timestamp($time, 'cache');
+               self::getApp()->saveTimestamp($time, 'cache');
 
                return $return;
        }
@@ -84,7 +79,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->get($key);
 
-               self::getApp()->save_timestamp($time, 'cache');
+               self::getApp()->saveTimestamp($time, 'cache');
 
                return $return;
        }
@@ -106,7 +101,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->set($key, $value, $duration);
 
-               self::getApp()->save_timestamp($time, 'cache_write');
+               self::getApp()->saveTimestamp($time, 'cache_write');
 
                return $return;
        }
@@ -124,7 +119,7 @@ class Cache extends \Friendica\BaseObject
 
                $return = self::getDriver()->delete($key);
 
-               self::getApp()->save_timestamp($time, 'cache_write');
+               self::getApp()->saveTimestamp($time, 'cache_write');
 
                return $return;
        }