You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/frontend/cacheitem.lua

23 lines
628 B
Lua

--[[
Inheritable abstraction for cache items
--]]
local CacheItem = {
size = 128, -- some reasonable default for a small table.
}
--- NOTE: As far as size estimations go, the assumption is that a key, value pair should roughly take two words,
--- and the most common items we cache are Geom-like tables (i.e., 4 key-value pairs).
--- That's generally a low estimation, especially for larger tables, where memory allocation trickery may be happening.
function CacheItem:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function CacheItem:onFree()
end
return CacheItem