mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Cache: Rewrite based on lua-lru
Ought to be faster than our naive array-based approach. Especially for the glyph cache, which has a solid amount of elements, and is mostly cache hits. (There are few things worse for performance in Lua than table.remove @ !tail and table.insert @ !tail, which this was full of :/). DocCache: New module that's now an actual Cache instance instead of a weird hack. Replaces "Cache" (the instance) as used across Document & co. Only Cache instance with on-disk persistence. ImageCache: Update to new Cache. GlyphCache: Update to new Cache. Also, actually free glyph bbs on eviction.
This commit is contained in:
@@ -5,10 +5,10 @@ It works using data gathered from a document interface.
|
||||
]]--
|
||||
|
||||
local BD = require("ui/bidi")
|
||||
local Cache = require("cache")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local Device = require("device")
|
||||
local DeviceListener = require("device/devicelistener")
|
||||
local DocCache = require("document/doccache")
|
||||
local DocSettings = require("docsettings")
|
||||
local DocumentRegistry = require("document/documentregistry")
|
||||
local Event = require("ui/event")
|
||||
@@ -733,8 +733,8 @@ function ReaderUI:onClose(full_refresh)
|
||||
if self.dialog ~= self then
|
||||
self:saveSettings()
|
||||
end
|
||||
-- serialize last used items for later launch
|
||||
Cache:serialize()
|
||||
-- Serialize the most recently displayed page for later launch
|
||||
DocCache:serialize()
|
||||
if self.document ~= nil then
|
||||
logger.dbg("closing document")
|
||||
self:notifyCloseDocument()
|
||||
|
||||
Reference in New Issue
Block a user