From d87e53ab90b4ac5c68af60b46538c2be7761c60c Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 23 Jun 2012 23:28:38 +0100 Subject: [PATCH] cache reported image count --- ext/report_image/main.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ext/report_image/main.php b/ext/report_image/main.php index bdbfab73..2f3ab3dd 100644 --- a/ext/report_image/main.php +++ b/ext/report_image/main.php @@ -152,7 +152,14 @@ class ReportImage extends Extension { public function count_reported_images() { global $database; - return $database->get_one("SELECT count(*) FROM image_reports"); + + $count = $database->cache->get("image-report-count"); + if(is_null($count) || $count === false) { + $count = $database->get_one("SELECT count(*) FROM image_reports"); + $database->cache->set("image-report-count", $count, 60); + } + + return $count; } } // ===== Changelog =====