From 4954c4b9aa1bbbfdbe564f7b184ed5a042d51a3a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 1 Mar 2018 00:33:56 -0500 Subject: [PATCH] Add cache timing points --- src/Core/Cache.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Core/Cache.php b/src/Core/Cache.php index 58969f0819..aeda29e849 100644 --- a/src/Core/Cache.php +++ b/src/Core/Cache.php @@ -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; } /** -- 2.39.5