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 | 2a073294ae4a6eccc10ffcef2a2146bfb9abe1ae (patch) | |
tree | 295ee0b29876d137b103a00cfad2870b0cb786d9 /plugins | |
parent | e21f31c7c282aa5fba3c37e6d1e829edb3b78a6b (diff) | |
download | prosody-2a073294ae4a6eccc10ffcef2a2146bfb9abe1ae.tar.gz prosody-2a073294ae4a6eccc10ffcef2a2146bfb9abe1ae.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" |