View Source BackBreeze.Cache behaviour (BackBreeze v0.4.2)

Defines the cache backend used by BackBreeze.

BackBreeze ships with BackBreeze.Cache.Default, which uses the cache implementation provided by this package. Runtimes with different storage capabilities can configure a backend of their own:

config :back_breeze, cache_backend: MyApp.BackBreezeCache

The backend must be configured before :back_breeze is compiled. Applications that need different cache behavior are responsible for providing that implementation.

Summary

Types

@type cache() :: :render | :stable | :prepared
@type cache_scope() :: :render | :prepared

Callbacks

@callback advance_generation() :: :ok
@callback children() :: [Supervisor.child_spec()]
@callback clear(cache_scope()) :: :ok
Link to this callback

fetch(cache, term, function)

View Source
@callback fetch(cache(), term(), (-> term())) :: term()
Link to this callback

max_memory_bytes()

View Source (optional)
@callback max_memory_bytes() :: non_neg_integer()
@callback size(cache_scope()) :: non_neg_integer()
@callback with_frame((-> term())) :: term()