Diff

plugins/mod_storage_sql.lua @ 9892:4803a25c7e36

mod_storage_sql: Cache total count if it's calculated as part of the current query
author Kim Alvefur <zash@zash.se>
date Fri, 22 Mar 2019 02:13:27 +0100
parent 9891:147b28d001a0
child 9893:15270547c91c
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Fri Mar 22 02:12:02 2019 +0100
+++ b/plugins/mod_storage_sql.lua	Fri Mar 22 02:13:27 2019 +0100
@@ -384,6 +384,9 @@
 					total = row[1];
 				end
 			end
+			if query.start == nil and query.with == nil and query["end"] == nil and query.key == nil then
+				archive_item_count_cache:set(cache_key, total);
+			end
 			if query.limit == 0 then -- Skip the real query
 				return noop, total;
 			end