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

fix the doc test for cachex #387

Open xiaoqianghan opened 2 weeks ago

xiaoqianghan commented 2 weeks ago

Our application relies heavily on Cachex as our local caching solution. Recently, while upgrading to Cachex 4.0, I noticed some changes in the Cachex.export/2 method. Specifically, the entry structure changed (the order of value and ttl was swapped), but this wasn't updated in the doctests and then discovered that the Cachex doctests weren't actually being used.

After adding doctest Cachex, I encountered a series of test failures. This PR is an attempt to fix the failing tests in the doctests. Here are the main points:

I'm unsure if these changes will affect the readability of the generated documentation. Feel free to add comments or require modifications.