cache key

This commit is contained in:
Shish 2020-02-13 02:09:31 +00:00
parent 58346f8b49
commit 43ab3088cf

View File

@ -235,7 +235,9 @@ class Image
} }
} else { } else {
// complex query // 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 (!$total) {
if (Extension::is_enabled(RatingsInfo::KEY)) { if (Extension::is_enabled(RatingsInfo::KEY)) {
$tags[] = "rating:*"; $tags[] = "rating:*";
@ -245,7 +247,7 @@ class Image
if (SPEED_HAX && $total > 5000) { if (SPEED_HAX && $total > 5000) {
// when we have a ton of images, the count // when we have a ton of images, the count
// won't change dramatically very often // won't change dramatically very often
$cache->set("image-count:" . Tag::implode($tags), $total, 3600); $cache->set($cache_key, $total, 3600);
} }
} }
} }