ShieldedCache v1.1.1 ExampleShieldedCluster View Source
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
get_or_fetch/1
Gets the requested value.
If the value is valid, returns the {:ok, value}
.
If the value is expired, returns the expired_value
and
adds the cache_request that requires a refresh to the TaskManager
.
If there is an error, returns {:error, reason}
.
Executes the get_or_fetch/1
function.
If the value is valid, returns the value
.
If the value is expired, returns the expired_value
and
adds the cache_request that requires a refresh to the TaskManager
.
If there is an error, raises the error.
init({cache_name :: module(), caching_module :: module()}) :: Supervisor.on_start()
Initializes the ShieldedCache
Supervisor,
which in turn starts the ShieldedCache.TaskManager
module
and the specified ShieldedCache.Cache
caching module
under the ShieldedCache
supervision tree.
Takes in a cache_request for data and runs the it through the serialize!/1
function
to return a serialized key for use as a key in the cache.
Returns the serialized key
or raises an error.
start_link(opts :: Keyword.t()) :: Supervisor.on_start()
Starts the ShieldedCache
Supervisor,
which in turn starts the ShieldedCache.TaskManager
module
and the specified ShieldedCache.Cache
caching module
under the ShieldedCache
supervision tree.