Money v2.2.2 Money.ExchangeRates.Cache behaviour View Source

Defines a cache behaviour and default inplementation of a cache for exchange rates

Link to this section Summary

Callbacks

Return the value for a given key in the cache

Returns the exchange rates for a given date

Initialize the cache when the exchange rates retriever is started

Retrieve the latest exchange rates from the cache

Put the given value under the given key in 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 retriver process stops normally

Link to this section Functions

Link to this section Callbacks

Return the value for a given key in the cache.

Link to this callback historic_rates(arg0) View Source
historic_rates(Date.t()) ::
  {:ok, Map.t()} | {:error, {Exception.t(), String.t()}}

Returns the exchange rates for a given date.

Initialize the cache when the exchange rates retriever is started

Link to this callback latest_rates() View Source
latest_rates() :: {:ok, Map.t()} | {:error, {Exception.t(), String.t()}}

Retrieve the latest exchange rates from the cache.

Link to this callback put(any, any) View Source
put(any(), any()) :: any()

Put the given value under the given key in the cache.

Link to this callback store_historic_rates(arg0, arg1) View Source
store_historic_rates(Map.t(), Date.t()) :: :ok

Store the historic exchange rates for a given date in the cache.

Link to this callback store_latest_rates(arg0, arg1) View Source
store_latest_rates(Map.t(), DateTime.t()) :: :ok

Store the latest exchange rates in the cache.

Link to this callback terminate() View Source
terminate() :: any()

Terminate the cache when the retriver process stops normally