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

Option :on_error for caching annotations to ignore cache exceptions when required #141

Closed
cabol opened this issue Oct 29, 2021 · 0 comments

Comments

@cabol
Copy link
Owner

cabol commented Oct 29, 2021

Since caching annotations handle the cache commands underneath, it is not possible to control the command execution, like doing nothing or ignoring any cache error and letting the function block be executed instead. To address it, the option :on_error is added to all caching annotations, and the possible values are: :raise (the default) or :nothing. If :on_error is set to :nothing, any exception during a cache command execution is ignored, and the function block is executed. For example:

@decorator cacheable(cache: MyCache, on_error: :nothing)
def get_something(key) do
  # your logic ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant