Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

tpickell-papa
Copy link

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.

@feld
Copy link
Contributor

feld commented Jan 26, 2024

It might be better to update the @spec to

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

@feld
Copy link
Contributor

feld commented Jan 27, 2024

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

@whitfin
Copy link
Owner

whitfin commented Mar 13, 2024

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 whitfin closed this Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants