cache thumbs for 24h instead of forever

This commit is contained in:
Shish 2020-02-26 10:42:08 +00:00
parent 33731e8cb0
commit ec7f63ee1f
2 changed files with 9 additions and 3 deletions

View file

@ -32,6 +32,12 @@ class RSSImages extends Extension
} }
} }
public function onImageInfoSet(ImageInfoSetEvent $event)
{
global $cache;
$cache->delete("rss-item-image:{$event->image->id}");
}
private function do_rss(array $images, array $search_terms, int $page_number) private function do_rss(array $images, array $search_terms, int $page_number)
{ {
global $page; global $page;
@ -81,7 +87,7 @@ class RSSImages extends Extension
{ {
global $cache; global $cache;
$cached = $cache->get("rss-thumb:{$image->id}"); $cached = $cache->get("rss-item-image:{$image->id}");
if ($cached) { if ($cached) {
return $cached; return $cached;
} }
@ -109,7 +115,7 @@ class RSSImages extends Extension
</item> </item>
"; ";
$cache->set("rss-thumb:{$image->id}", $data, 3600); $cache->set("rss-item-image:{$image->id}", $data, 86400);
return $data; return $data;
} }

View file

@ -32,7 +32,7 @@ class Themelet extends BaseThemelet
"</div>\n"; "</div>\n";
// cache for ages; will be cleared in ext/index:onImageInfoSet // cache for ages; will be cleared in ext/index:onImageInfoSet
$cache->set("thumb-block:{$image->id}", $html, 0); $cache->set("thumb-block:{$image->id}", $html, 86400);
return $html; return $html;
} }