moize
moize copied to clipboard
Derive `maxAge` from function return value?
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.