Defines the cache behaviour for exchange rates.
Summary
Callbacks
Retrieve the exchange rates for a given date.
Initialize the cache when the exchange rates retriever is started
Return the timestamp when the exchange rates were last updated.
Retrieve the latest exchange rates from the cache.
Store the historic exchange rates for a given date in the cache.
Store the latest exchange rates in the cache.
Terminate the cache when the retriever process stops normally
Callbacks
@callback historic_rates(Date.t()) :: {:ok, map()} | {:error, {Exception.t(), String.t()}}
Retrieve the exchange rates for a given date.
@callback init() :: any()
Initialize the cache when the exchange rates retriever is started
@callback last_updated() :: {:ok, DateTime.t()} | {:error, {Exception.t(), String.t()}}
Return the timestamp when the exchange rates were last updated.
@callback latest_rates() :: {:ok, map()} | {:error, {Exception.t(), String.t()}}
Retrieve the latest exchange rates from the cache.
Store the historic exchange rates for a given date in the cache.
@callback store_latest_rates(map(), DateTime.t()) :: :ok
Store the latest exchange rates in the cache.
@callback terminate() :: any()
Terminate the cache when the retriever process stops normally