Mercurial > prosody-hg
comparison 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 |
| parents | 147b28d001a0 |
| children | 15270547c91c |
comparison
equal
deleted
inserted
replaced
| 9891:147b28d001a0 | 9892:4803a25c7e36 |
|---|---|
| 381 .. t_concat(where, " AND "), unpack(args)); | 381 .. t_concat(where, " AND "), unpack(args)); |
| 382 if stats then | 382 if stats then |
| 383 for row in stats do | 383 for row in stats do |
| 384 total = row[1]; | 384 total = row[1]; |
| 385 end | 385 end |
| 386 end | |
| 387 if query.start == nil and query.with == nil and query["end"] == nil and query.key == nil then | |
| 388 archive_item_count_cache:set(cache_key, total); | |
| 386 end | 389 end |
| 387 if query.limit == 0 then -- Skip the real query | 390 if query.limit == 0 then -- Skip the real query |
| 388 return noop, total; | 391 return noop, total; |
| 389 end | 392 end |
| 390 end | 393 end |
