diff options
author | Kim Alvefur <zash@zash.se> | 2023-06-30 22:01:55 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-06-30 22:01:55 +0200 |
commit | 915ef3a222a4b2b1472fe73dc88f7ce4e4a9420b (patch) | |
tree | 981fba8364e21dc156d4ab2267f07b4a2a2de313 /spec | |
parent | 29b6ed4f0a40f0f595d21537e1308f744b9a4907 (diff) | |
download | prosody-915ef3a222a4b2b1472fe73dc88f7ce4e4a9420b.tar.gz prosody-915ef3a222a4b2b1472fe73dc88f7ce4e4a9420b.zip |
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)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/util_cache_spec.lua | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/spec/util_cache_spec.lua b/spec/util_cache_spec.lua index d4e609ed..ae7b1936 100644 --- a/spec/util_cache_spec.lua +++ b/spec/util_cache_spec.lua @@ -390,8 +390,7 @@ describe("util.cache", function() 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 |