diff options
author | zotlabs <mike@macgirvin.com> | 2020-01-14 13:34:56 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2020-01-14 13:34:56 -0800 |
commit | 293d411efb28b8f20a0208e3c52883e9fbb8cea7 (patch) | |
tree | a8b0af66015815d56342daf8301ab5ae095eda0a /Zotlabs/Lib/Cache.php | |
parent | 2a287e6def5ab54037222c963ab0875faf62fc1a (diff) | |
parent | d96f4340e80207a29a5c1c49cae8c25e3934d5ae (diff) | |
download | volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.gz volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.tar.bz2 volse-hubzilla-293d411efb28b8f20a0208e3c52883e9fbb8cea7.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Lib/Cache.php')
-rw-r--r-- | Zotlabs/Lib/Cache.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Zotlabs/Lib/Cache.php b/Zotlabs/Lib/Cache.php index 878201a42..a5052a183 100644 --- a/Zotlabs/Lib/Cache.php +++ b/Zotlabs/Lib/Cache.php @@ -7,14 +7,23 @@ namespace Zotlabs\Lib; */ class Cache { - public static function get($key) { + + /** + * @brief Returns cached content + * + * @param string $key + * @param string $age in SQL format, default is '30 DAY' + * @return string + */ + + public static function get($key, $age = '') { $hash = hash('whirlpool',$key); $r = q("SELECT v FROM cache WHERE k = '%s' AND updated > %s - INTERVAL %s LIMIT 1", dbesc($hash), db_utcnow(), - db_quoteinterval(get_config('system','object_cache_days', '30') . ' DAY') + db_quoteinterval(($age ? $age : get_config('system','object_cache_days', '30') . ' DAY')) ); if ($r) @@ -43,4 +52,3 @@ class Cache { } } } - |