View Source Cachex.Provision behaviour (Cachex v4.0.1)
Module controlling provisioning behaviour definitions.
This module defines the provisioning implementation for Cachex, allowing
components such as hooks and warmers to tap into state changes in the cache
table. By implementing handle_provision/2
these components can be provided
with new versions of state as they're created.
Summary
Callbacks
Handles a provisioning call.
Returns an enumerable of provisions this implementation requires.
Callbacks
@callback handle_provision( provison :: {type :: atom(), value :: any()}, state :: any() ) :: {:ok, state :: any()}
Handles a provisioning call.
The provided argument will be a Tuple dictating the type of value being provisioned along with the value itself. This can be used to listen on states required for hook executions (such as cache records).
@callback provisions() :: [type :: atom()]
Returns an enumerable of provisions this implementation requires.
The current provisions available are:
cache
- a cache instance used to make cache calls with lower overhead.
This should always return an enumerable of atoms; in the case of no required provisions an empty enumerable should be returned.