From ec7f63ee1f096576b7c930775547670c788f163e Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 26 Feb 2020 10:42:08 +0000 Subject: [PATCH] cache thumbs for 24h instead of forever --- ext/rss_images/main.php | 10 ++++++++-- themes/rule34v2/themelet.class.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/rss_images/main.php b/ext/rss_images/main.php index 59ae3d90..5f26b54c 100644 --- a/ext/rss_images/main.php +++ b/ext/rss_images/main.php @@ -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) { global $page; @@ -81,7 +87,7 @@ class RSSImages extends Extension { global $cache; - $cached = $cache->get("rss-thumb:{$image->id}"); + $cached = $cache->get("rss-item-image:{$image->id}"); if ($cached) { return $cached; } @@ -109,7 +115,7 @@ class RSSImages extends Extension "; - $cache->set("rss-thumb:{$image->id}", $data, 3600); + $cache->set("rss-item-image:{$image->id}", $data, 86400); return $data; } diff --git a/themes/rule34v2/themelet.class.php b/themes/rule34v2/themelet.class.php index bc7ad99a..8d5a5ed8 100644 --- a/themes/rule34v2/themelet.class.php +++ b/themes/rule34v2/themelet.class.php @@ -32,7 +32,7 @@ class Themelet extends BaseThemelet "\n"; // 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; }