ShieldedCache v1.4.0 ShieldedCache behaviour View Source
ShieldedCache
ShieldedCache is a caching module for Elixir.
What makes it special?
It enables a type of CDN Shielding on your cache that allows you to return stale results while simultaneously refreshing your data. This allows you to always return data to your client incredibly fast after the first request is made, while still refreshing data in an async way to keep subsequent requests fresh.
Callbacks
fetch/1
: Executes the cache request and fetches the datakey/1
: Generates a key out of the cache request
Overrideable Functions
key/1
: Generates a key from a cache requestpre_get_side_effect/1
: Creates a side effect before the get happens in the cachepost_get_side_effect/1
: Creates a side effect after the get happens in the cachepre_fetch_side_effect/1
: Creates a side effect before the fetch happens in the cachepost_fetch_side_effect/1
: Creates a side effect after the fetch happens in the cacheexpired_side_effect/1
: Creates a side effect when an expired value is returned from the cachefirst_fetch_side_effect/1
: Creates a side effect on the first fetch of the request (when there is no previous value for this request in the cache)get_or_fetch_response_time_side_effect/2
: Creates a side effect with the response time of theget_or_fetch
function for the requestget_response_time_side_effect/2
: Creates a side effect with the response time of theget
function for the requestfetch_response_time_side_effect/2
: Creates a side effect with the response time of thefetch
function for the request
Defaults
key/1
: Uses theserialize!/1
function to serialize whatever the cache request is into a key for the cache.pre_get_side_effect/1
: Doesnil
post_get_side_effect/1
: Doesnil
pre_fetch_side_effect/1
: Doesnil
post_fetch_side_effect/1
: Doesnil
expired_side_effect/1
: Doesnil
first_fetch_side_effect/1
: Doesnil
get_or_fetch_response_time_side_effect/2
: Doesnil
get_response_time_side_effect/2
: Doesnil
fetch_response_time_side_effect/2
: Doesnil
Link to this section Summary
Types
Return values of all functions for the cache
Link to this section Types
Return values of all functions for the cache
Link to this section Functions
Link to this section Callbacks
Link to this callback
fetch(cache_request)
View Source
fetch(cache_request :: term()) :: fetch_return()