cachex
cachex copied to clipboard
Adds the {:error, :no_cache} case to function doc to be clear
We ran into this in production and the developers that wrote the code using Cachex did not know that
get could return anything other than {:ok, "value"}
or {:ok, nil}
When looking at the docs for the function call I can see why.
This may be helpful for others using this lib in their code.
It might be better to update the @spec
to
@spec get(cache, any, Keyword.t()) :: {:ok, any()} | {:error, :no_cache}
the {:error, :no_cache} should be added to the @spec
of get_and_update/4 -- just ran into this as well
Given that the specs have been updated by @feld I'm going to close this; it should be communicated more clearly now. Thank you for raising this regardless!