View Source Bonfire.Common.Cache (Bonfire v0.9.11-social-beta.3)

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

cache_store(opts \\ [])

cached_preloads_for_objects(name, objects, fun)

get(key, opts \\ [])

get!(key, opts \\ [])

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

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.

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

remove(key, opts \\ [])

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

remove_all(opts \\ [])

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

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