Cache: Fix a whole lot of things.

* Minor updates to the min & max cache sizes (16 & 64MB). Mostly to satisfy my power-of-two OCD.
  * Purge broken on-disk cache files
  * Optimize free RAM computations
  * Start dropping LRU items when running low on memory before pre-rendring (hinting) pages in non-reflowable documents.
  * Make serialize dump the most recently *displayed* page, as the actual MRU item is the most recently *hinted* page, not the current one.
  * Use more accurate item size estimations across the whole codebase.

TileCacheItem:

  * Drop lua-serialize in favor of Persist.

KoptInterface:

  * Drop lua-serialize in favor of Persist.
  * Make KOPTContext caching actually work by ensuring its hash is stable.
This commit is contained in:
NiLuJe
2021-05-03 05:20:14 +02:00
parent e7acec1526
commit ce624be8b8
16 changed files with 351 additions and 108 deletions

View File

@@ -733,13 +733,13 @@ function ReaderUI:onClose(full_refresh)
if self.dialog ~= self then
self:saveSettings()
end
-- serialize last used items for later launch
Cache:serialize()
if self.document ~= nil then
logger.dbg("closing document")
self:notifyCloseDocument()
end
UIManager:close(self.dialog, full_refresh and "full")
-- serialize last used items for later launch
Cache:serialize()
if _running_instance == self then
_running_instance = nil
end