Access tokens a provider gets for a site's keys (PayPal's OAuth token), kept until shortly before they expire so each call does not ask for a new one. An ETS table read and written by the callers themselves; this process only owns it, so no call ever waits on it.
Two callers that find no token at the same time both ask the provider and both keep theirs: each token is valid, and the next caller reads one of them.
Summary
Functions
Returns a specification to start this module under a supervisor.
Forgets the token under key, such as one the provider no longer takes.
The token kept under key, or a new one from fetch ({:ok, token, expires_in_seconds}),
kept for next time. An error from fetch is answered as it is and nothing is kept.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec drop(term()) :: true
Forgets the token under key, such as one the provider no longer takes.
@spec get(term(), (-> {:ok, String.t(), pos_integer()} | {:error, term()})) :: {:ok, String.t()} | {:error, term()}
The token kept under key, or a new one from fetch ({:ok, token, expires_in_seconds}),
kept for next time. An error from fetch is answered as it is and nothing is kept.