aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-01-09 08:38:48 +0000
committerMario <mario@mariovavti.com>2020-01-09 08:38:48 +0000
commit662e8f8a4c67e9a7de579ff93f4c36ae2006e186 (patch)
treea178e962f7d851dc9af4aa6d7102a2e6ca85a42d
parent5c4301369235b7f03a4654e81ded6b9da3b98891 (diff)
parent7397348b9c535cd419ff187fbd36d01f1fe95260 (diff)
downloadvolse-hubzilla-662e8f8a4c67e9a7de579ff93f4c36ae2006e186.tar.gz
volse-hubzilla-662e8f8a4c67e9a7de579ff93f4c36ae2006e186.tar.bz2
volse-hubzilla-662e8f8a4c67e9a7de579ff93f4c36ae2006e186.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
-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 {
}
}
}
-