AppleMapsServer.TokenCache (apple_maps_server v0.2.0)

Copy Markdown View Source

Caches the Apple Maps access token so we don't exchange a new JWT on every call.

The cache is keyed by Application env config — pass per-call opts to bypass it. Tokens are refreshed automatically when they're within @refresh_buffer_seconds of expiry, so callers always receive a token with comfortable time-to-live.

Summary

Functions

Returns a specification to start this module under a supervisor.

Forget the cached token. Primarily useful in tests and after 401s.

Return a fresh access token, minting/refreshing as needed.

Start the cache under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear(server \\ __MODULE__)

Forget the cached token. Primarily useful in tests and after 401s.

fetch(server \\ __MODULE__)

Return a fresh access token, minting/refreshing as needed.

start_link(opts \\ [])

Start the cache under a supervisor.