Skip to content

Invalidating depending on return #27

Description

@manuel-rubio

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions