Software /
code /
prosody
Changeset
8396:fbe1f99fb245
util.cache: Add method for removing all data (does not call eviction callback)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Nov 2017 00:38:47 +0100 |
parents | 8395:fbb9a1c2120e |
children | 8397:99d85731e3ee |
files | util/cache.lua |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/cache.lua Thu Nov 09 16:50:36 2017 +0100 +++ b/util/cache.lua Tue Nov 07 00:38:47 2017 +0100 @@ -139,6 +139,13 @@ 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);