ExShopifyApp.AppEvents.TokenCache behaviour (ex_shopify_app v1.2.0)
Behaviour for a cached Shopify app events access-token source.
ExShopifyApp.AppEvents resolves the configured implementation via
ExShopifyApp.app_events_config/0 and calls fetch/0 on it. The default
implementation is ExShopifyApp.AppEvents.TokenServer, a supervised GenServer that
serializes token refreshes so concurrent first-callers coalesce onto a single token
fetch. Swap it for your own (e.g. a Cachex/ETS TTL cache with non-blocking reads):
config :ex_shopify_app, :app_events,
token_cache: MyApp.TokenCacheIf you supervise your implementation yourself, disable the library's auto-start:
config :ex_shopify_app, :app_events,
start_token_cache: false
Summary
Types
@type token() :: String.t()
A Shopify app events access token.
Callbacks
@callback fetch(GenServer.server()) :: {:ok, token()} | {:error, any()}