melpon / memoize

A method caching macro for elixir using CAS on ETS.
https://hex.pm/packages/memoize
MIT License
189 stars 12 forks source link

Failed to invalidate cache with argument is map #21

Closed phanmn closed 2 years ago

phanmn commented 2 years ago

Test

f = fn -> 10 end
Memoize.Cache.get_or_run({:mod1, :fun1, [%{a: 1}]}, f)
assert 1 == Memoize.invalidate(:mod1, :fun1, [%{a: 1}])
phanmn commented 2 years ago

Fix by update file lib/memoize/cache.ex

def invalidate(key) do
    key = normalize_key(key)
    cache_strategy().invalidate(key)
end
melpon commented 2 years ago

fixed by https://github.com/melpon/memoize/pull/22