add standalone glyph cache

I found it will be especially helpful to cache glyph separately
so that glyph caches won't be washed out by a single page cache.
This commit is contained in:
chrox
2013-03-24 18:37:33 +08:00
parent 039eea17ae
commit 01f045e7f9
2 changed files with 19 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
require "dbg"
--[[
Inheritable abstraction for cache items
]]--
@@ -29,8 +30,14 @@ Cache = {
cache_order = {}
}
function Cache:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function Cache:insert(key, object)
--@TODO add cache for different types of item 09.01 2013 (houqp)
-- guarantee that we have enough memory in cache
if(object.size > self.max_memsize) then
-- we're not allowed to claim this much at all