whitfin / cachex

A powerful caching library for Elixir with support for transactions, fallbacks and expirations
https://hexdocs.pm/cachex/
MIT License
1.6k stars 103 forks source link

Small documentation issues #385

Closed Cikey closed 2 weeks ago

Cikey commented 2 weeks ago

Hi there,

we just updated to Cachex 4.0.2 and had some observations when applying the migration guide:

  1. Cachex.fetch seems to omit the optional expire setting in the call result. This is not documented and is also wrongly shown in the function documentation: https://hexdocs.pm/cachex/Cachex.html#fetch/4 (last code example). Tests were updated in https://github.com/whitfin/cachex/commit/b976fb3d1be2228acc61fb7fd2e8c0a635ca5c51 so i guess its intentional? The function docs also still call it ttl.
  2. Cachex.restore is described as which behave in exactly the same way in the migration guide, but the return value changed from {:ok, true} to {:ok, number_of_keys}. I guess the method signature did not change from {status(), any()} but it was still a problem for our more conservative pattern match which included the true value.
whitfin commented 2 weeks ago

Hi @Cikey!

Yes, the change to Cachex.fetch/4 was intentional, I just missed out on updating the documentation I guess.

You're right, that's bad wording (Cachex.load/3 was changed to that same format before it was removed), so I'll update that section too.

I changed these in https://github.com/whitfin/cachex/commit/b1c6cf8615552a3da1cbf9bbf594b3468aa4080d - let me know if that looks good to you!

Cikey commented 2 weeks ago

Looks great! Thanks for the quick fixes!