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

Invalidating depending on return #27

Open
manuel-rubio opened this issue Jan 9, 2025 · 0 comments
Open

Invalidating depending on return #27

manuel-rubio opened this issue Jan 9, 2025 · 0 comments

Comments

@manuel-rubio
Copy link

Could we configure different times for expiration depending on the kind of return?

I mean, if I have the following function:

defmemo request_data, expires: :timer.hours(1) do
  case get("/data") do
    {:ok, %{body: body}} -> {:ok, body}
    {:error, _reason} = error -> error
  end
end

In this situation, maybe the {:error, _reason} isn't a good idea to keep it for one hour and we could keep it only for one minute or 5 seconds.

Maybe it could have something that rewrites the expiration previously to return so we could configure one hour for the OK case and five seconds for the error case.

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

No branches or pull requests

1 participant