cache_tab icon indicating copy to clipboard operation
cache_tab copied to clipboard

cache_tab caching errors

Open santiagopoli opened this issue 9 years ago • 1 comments

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

santiagopoli avatar Sep 02 '16 15:09 santiagopoli

Yes, there is a cache_missed option which is true by default.

zinid avatar Jan 13 '17 11:01 zinid