Storyblok.Cache behaviour (storyblok v2024.3.13-beta.1)
This callback must be implemented to utilize caching.
Implement fetch/2
and set/4
and add the following to your config.
config :storyblok, cache: true, cache_store: MyApp.CacheStore
Summary
Callbacks
Callback for getting data for key from cache store/
Callback for setting data with the given key. expire_in_ms is the TTL for the key in milliseconds.
Types
Link to this type
json()
@type json() :: binary()
Valid JSON
Callbacks
Link to this callback
fetch(key, opts)
Callback for getting data for key from cache store/
Link to this callback
set(key, value, expire_in_ms, opts)
@callback set( key :: binary(), value :: json(), expire_in_ms :: integer(), opts :: keyword() ) :: :ok | {:error, any()}
Callback for setting data with the given key. expire_in_ms is the TTL for the key in milliseconds.