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.
Could we configure different times for expiration depending on the kind of return?
I mean, if I have the following function:
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.