ConfigCat.ConfigCache behaviour (ConfigCat v2.0.0) View Source
Defines a configuration cache.
A calling application can optionally supply its own cache implementation to use
in place of the default in-memory cache by providing the implementation's module name
as the :cache
option in ConfigCat.start_link/1
.
The provided implementation must explicitly or implicitly implement this behaviour.
If the cache implementation is a GenServer or similar, it is the calling application's responsibility to add it to its own supervision tree.
Link to this section Summary
Callbacks
Fetches the configuration stored under the given cache key.
Stores an updated configuration under the given cache key.
Link to this section Types
Specs
key() :: String.t()
The cache key under which the configuration is stored
Specs
result() :: {:ok, ConfigCat.Config.t()} | {:error, :not_found}
The result of a cache fetch.
Link to this section Callbacks
Specs
Fetches the configuration stored under the given cache key.
Returns {:ok, config}
if there is a cached configuration or
{:error, :not_found}
if not.
Specs
set(key(), config :: ConfigCat.Config.t()) :: :ok
Stores an updated configuration under the given cache key.
Returns :ok.