From 43ab3088cf0ca0644aafcce9f98c84a98316dd68 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 13 Feb 2020 02:09:31 +0000 Subject: [PATCH] cache key --- core/imageboard/image.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/imageboard/image.php b/core/imageboard/image.php index 0d834406..a6b5b7ff 100644 --- a/core/imageboard/image.php +++ b/core/imageboard/image.php @@ -235,7 +235,9 @@ class Image } } else { // complex query - $total = $cache->get("image-count:" . Tag::implode($tags)); + // implode(tags) can be too long for memcache... + $cache_key = "image-count:" . md5(Tag::implode($tags)); + $total = $cache->get($cache_key); if (!$total) { if (Extension::is_enabled(RatingsInfo::KEY)) { $tags[] = "rating:*"; @@ -245,7 +247,7 @@ class Image if (SPEED_HAX && $total > 5000) { // when we have a ton of images, the count // won't change dramatically very often - $cache->set("image-count:" . Tag::implode($tags), $total, 3600); + $cache->set($cache_key, $total, 3600); } } }