aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-01-09 09:30:36 +0100
committerMario <mario@mariovavti.com>2020-01-09 09:30:36 +0100
commit7397348b9c535cd419ff187fbd36d01f1fe95260 (patch)
tree1ae5ce6287e0637d5b2f3ad48834b6d91597a6a9 /Zotlabs
parent6add6ce79b731de63d3b401923fb26b9e265f956 (diff)
parent908875a052ac76e24af74fc714b350c217de42b4 (diff)
downloadvolse-hubzilla-7397348b9c535cd419ff187fbd36d01f1fe95260.tar.gz
volse-hubzilla-7397348b9c535cd419ff187fbd36d01f1fe95260.tar.bz2
volse-hubzilla-7397348b9c535cd419ff187fbd36d01f1fe95260.zip
Merge branch 'dev' into 'dev'
Add age choice on cached item retrieve See merge request hubzilla/core!1813
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Cache.php14
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 {
}
}
}
-