aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/cache.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/cache.lua b/util/cache.lua
index 9c141bb6..d12551cc 100644
--- a/util/cache.lua
+++ b/util/cache.lua
@@ -139,6 +139,13 @@ function cache_methods:table()
return self.proxy_table;
end
+function cache_methods:clear()
+ self._data = {};
+ self._count = 0;
+ self._head = nil;
+ self._tail = nil;
+end
+
local function new(size, on_evict)
size = assert(tonumber(size), "cache size must be a number");
size = math.floor(size);