You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When this function returns false, even though the value gets cached, the next time it is called it won't use the cached value and issue another http request.
Problem here is if cache.get(key, opts) evals to false (this is my case) this line value = cache.get(key, opts) evals to false, you can test in iex with:
iex(1)>x=falsefalse
Since this is not a pure function and the value gets cached I wasn't able to make a failing test case for it, but it seems that to fix this you can change those lines to:
Thanks for report the issue, question, would you like to send a PR with the fix? Otherwise, NP, I can take a look at it and apply the fix. Let me know, stay tuned! Thanks again!
Hello there,
I have a function similar to this one:
When this function returns
false
, even though the value gets cached, the next time it is called it won't use the cached value and issue another http request.I tracked down the problem to this code:
nebulex/lib/nebulex/caching.ex
Lines 481 to 484 in 7dcdd30
Problem here is if
cache.get(key, opts)
evals to false (this is my case) this linevalue = cache.get(key, opts)
evals to false, you can test in iex with:Since this is not a pure function and the value gets cached I wasn't able to make a failing test case for it, but it seems that to fix this you can change those lines to:
I ran the tests here after the change and they pass.
The text was updated successfully, but these errors were encountered: