ETS-backed token cache for APNs JWT and FCM OAuth2 access tokens.
Tokens are stored with their expiry time. Callers get a cached token when available and unexpired; otherwise the cache fetches a fresh one.
This GenServer is started automatically by the MobPush application. You don't need to interact with it directly.
Summary
Functions
Returns a specification to start this module under a supervisor.
Evict a cached token (useful when a 401 is received).
Fetch a cached token, or call fetch_fn/0 to produce a fresh one.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec evict(key :: term()) :: :ok
Evict a cached token (useful when a 401 is received).
@spec get( key :: term(), fetch_fn :: (-> {:ok, {String.t(), expires_at :: integer()}} | {:error, term()}) ) :: {:ok, String.t()} | {:error, term()}
Fetch a cached token, or call fetch_fn/0 to produce a fresh one.