mirror of
https://github.com/bjc/prosody.git
synced 2025-04-07 07:07:38 +03:00
mod_storage_sql: Return cached count if only this is queried for
This commit is contained in:
parent
5029870d3e
commit
9393931a25
1 changed files with 5 additions and 1 deletions
|
@ -362,7 +362,11 @@ end
|
||||||
function archive_store:find(username, query)
|
function archive_store:find(username, query)
|
||||||
query = query or {};
|
query = query or {};
|
||||||
local user,store = username,self.store;
|
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 ok, result = engine:transaction(function()
|
||||||
local sql_query = [[
|
local sql_query = [[
|
||||||
SELECT "key", "type", "value", "when", "with"
|
SELECT "key", "type", "value", "when", "with"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue