cache_tab
cache_tab copied to clipboard
cache_tab caching errors
When I cache something which returns "error", the value is cached.
For example:
> cache_tab:new(cache_test, []).
> cache_tab:lookup(cache_test, key1, fun() -> error end).
> error
> cache_tab:lookup(cache_test, key1, fun() -> {ok, 1} end).
> error
I was expecting to get 1 as a value instead of error. It seems that cache_tab is caching the error as well. Maybe the documentation is wrong and I need to return something else.
Thanks!
PS: I'm using version 1.0.4 of cache_tab
Yes, there is a cache_missed option which is true by default.