aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-22 02:13:27 +0100
committerKim Alvefur <zash@zash.se>2019-03-22 02:13:27 +0100
commit5029870d3eee5bbe50c012fe1e7f4ee62e62ee24 (patch)
tree6f3b9a2a462020d4010e94f90dfc65618f91d091
parent56a9e395ade713122fd2251a64232abd270cadbe (diff)
downloadprosody-5029870d3eee5bbe50c012fe1e7f4ee62e62ee24.tar.gz
prosody-5029870d3eee5bbe50c012fe1e7f4ee62e62ee24.zip
mod_storage_sql: Cache total count if it's calculated as part of the current query
-rw-r--r--plugins/mod_storage_sql.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 35a16870..b3bd5171 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -384,6 +384,9 @@ function archive_store:find(username, query)
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