Software /
code /
prosody
Diff
spec/util_cache_spec.lua @ 13175:bbdaa770b955
util.cache: Pass cache itself to eviction callback
Simplifies access to the cache without moving code around a lot given
the currently common pattern of
local some_cache = cache.new(size, function(k,v) end)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 30 Jun 2023 22:01:55 +0200 |
parent | 13174:8ec7b7d6556f |
line wrap: on
line diff
--- a/spec/util_cache_spec.lua Fri Jun 30 22:01:49 2023 +0200 +++ b/spec/util_cache_spec.lua Fri Jun 30 22:01:55 2023 +0200 @@ -390,8 +390,7 @@ end); it("eviction stuff", function () - local c; - c = cache.new(4, function(_k,_v) + local c = cache.new(4, function(_k,_v,c) if c.size < 10 then c:resize(c.size*2); end