add the observer hash to the cache key in categories_widget()

This commit is contained in:
Mario
2024-03-25 16:09:53 +00:00
parent 6c033fc776
commit 6e592ed200
3 changed files with 12 additions and 6 deletions

View File

@@ -11,6 +11,7 @@ class Cache_query {
if(! $argc == 3)
return;
$r = null;
$key = $argv[1];
$pid = get_config('procid', $key, false);
@@ -28,8 +29,10 @@ class Cache_query {
$arr = json_decode(base64_decode($argv[0]), true);
$r = call_user_func_array('q', $arr);
if($r)
if(is_array($r)) {
Cache::set($key, serialize($r));
}
del_config('procid', $key);

View File

@@ -1,6 +1,7 @@
<?php /** @file */
use Zotlabs\Lib\Cache;
use Zotlabs\Daemon\Master;
function findpeople_widget() {
@@ -70,7 +71,9 @@ function categories_widget($baseurl,$selected = '') {
$item_normal = item_normal();
$key = __FUNCTION__ . "-" . App::$profile['profile_uid'];
$observer = get_observer_hash();
$key = __FUNCTION__ . '_' . md5(App::$profile['profile_uid'] . $observer);
$content = Cache::get($key, '5 MINUTE');
if (! $content) {
@@ -96,7 +99,7 @@ function categories_widget($baseurl,$selected = '') {
dbesc(ACTIVITY_UPDATE)
];
\Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]);
Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]);
}
if (!$content) {

View File

@@ -6,7 +6,7 @@
// To do this we need to escape these characters if they appear in our tag.
use Zotlabs\Lib\Cache;
use Zotlabs\Daemon\Master;
function file_tag_encode($s) {
return str_replace(array('<','>','[',']'),array('%3c','%3e','%5b','%5d'),$s);
@@ -357,7 +357,7 @@ function pub_tagadelic($net, $site, $limit, $recent, $safemode, $type) {
}
}
$key = __FUNCTION__ . "-" . md5($site . $recent . $safemode . $limit . $type);
$key = __FUNCTION__ . '_' . md5($site . $recent . $safemode . $limit . $type);
$content = Cache::get($key, '5 MINUTE');
if(! $content) {
@@ -377,7 +377,7 @@ function pub_tagadelic($net, $site, $limit, $recent, $safemode, $type) {
(intval($count) ? "LIMIT $count" : '')
];
\Zotlabs\Daemon\Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]);
Master::Summon([ 'Cache_query', $key, base64_encode(json_encode($arr)) ]);
}
$r = unserialize($content);