moize icon indicating copy to clipboard operation
moize copied to clipboard

Derive `maxAge` from function return value?

Open gregory-j-baker opened this issue 3 months ago • 0 comments

Is it possible to set a cache's maxAge according to the value that is returned by the memoized function?

I am fetching an OAuth access token which has an expires_in value, and I would like to cache the token for approximately as long as it is valid. The problem is that the value of expires_in is set by the remote auth server and is unknown until I actually fetch the token.

gregory-j-baker avatar Mar 10 '24 13:03 gregory-j-baker