]> git.mxchange.org Git - friendica.git/commitdiff
Add cache timing points
authorHypolite Petovan <mrpetovan@gmail.com>
Thu, 1 Mar 2018 05:33:56 +0000 (00:33 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Mon, 5 Mar 2018 04:13:19 +0000 (23:13 -0500)
src/Core/Cache.php

index 58969f0819f4a25498c20c518018e093d7fd5093..aeda29e849be94ba48e7397419b22a8ec506d646 100644 (file)
@@ -10,7 +10,7 @@ use Friendica\Core\Config;
 /**
  * @brief Class for storing data for a short time
  */
-class Cache
+class Cache extends \Friendica\BaseObject
 {
        const MONTH        = 0;
        const WEEK         = 1;
@@ -108,7 +108,13 @@ class Cache
         */
        public static function get($key)
        {
-               return self::getDriver()->get($key);
+               $time = microtime(true);
+
+               $return = self::getDriver()->get($key);
+
+               self::getApp()->save_timestamp($time, 'cache');
+
+               return $return;
        }
 
        /**
@@ -124,7 +130,13 @@ class Cache
         */
        public static function set($key, $value, $duration = self::MONTH)
        {
-               return self::getDriver()->set($key, $value, $duration);
+               $time = microtime(true);
+
+               $return = self::getDriver()->set($key, $value, $duration);
+
+               self::getApp()->save_timestamp($time, 'cache_write');
+
+               return $return;
        }
 
        /**