cachex icon indicating copy to clipboard operation
cachex copied to clipboard

Adds the {:error, :no_cache} case to function doc to be clear

Open tpickell-papa opened this issue 1 year ago • 2 comments

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.

tpickell-papa avatar Jun 02 '23 15:06 tpickell-papa

It might be better to update the @spec to

 @spec get(cache, any, Keyword.t()) :: {:ok, any()} | {:error, :no_cache}

feld avatar Jan 26 '24 20:01 feld

the {:error, :no_cache} should be added to the @spec of get_and_update/4 -- just ran into this as well

feld avatar Jan 27 '24 20:01 feld

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!

whitfin avatar Mar 13 '24 16:03 whitfin