View Source Bonfire.Common.Cache (Bonfire v0.9.10-classic-beta.156)

Helpers for caching data and operations

Summary

Functions

Takes a function (or module and function names) and a set of arguments for that function, and tries to fetch the previous result of running that function from the in-memory cache, using the MFA (module name/function name/arguments used) to generate the cache key. If it's not in the cache, it executes the function, and caches and returns the result.

It removes the entry associated with a key from the cache.

It removes the result of a given function from the cache.

Functions

Link to this function

cached_preloads_for_objects(name, objects, fun)

View Source
Link to this function

maybe_apply_cached(fun, args \\ [], opts \\ [])

View Source

Takes a function (or module and function names) and a set of arguments for that function, and tries to fetch the previous result of running that function from the in-memory cache, using the MFA (module name/function name/arguments used) to generate the cache key. If it's not in the cache, it executes the function, and caches and returns the result.

Link to this function

put(key, value, opts \\ [])

View Source

It removes the entry associated with a key from the cache.

Link to this function

reset(fun, args, opts \\ [])

View Source

It removes the result of a given function from the cache.