diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-22 02:18:54 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-22 02:18:54 +0100 |
commit | 9393931a25367390465b480b8dbaa38e9f199b54 (patch) | |
tree | 295ee0b29876d137b103a00cfad2870b0cb786d9 /plugins | |
parent | 5029870d3eee5bbe50c012fe1e7f4ee62e62ee24 (diff) | |
download | prosody-9393931a25367390465b480b8dbaa38e9f199b54.tar.gz prosody-9393931a25367390465b480b8dbaa38e9f199b54.zip |
mod_storage_sql: Return cached count if only this is queried for
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index b3bd5171..8c03da01 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -362,7 +362,11 @@ end function archive_store:find(username, query) query = query or {}; local user,store = username,self.store; - local total; + local cache_key = jid_join(username, host, self.store); + local total = archive_item_count_cache:get(cache_key); + if total ~= nil and query.limit == 0 and query.start == nil and query.with == nil and query["end"] == nil and query.key == nil then + return noop, total; + end local ok, result = engine:transaction(function() local sql_query = [[ SELECT "key", "type", "value", "when", "with" |