View Source Nebulex.Caching (Nebulex v2.6.2)

At its core, the abstraction applies caching to Elixir functions, reducing thus the number of executions based on the information available in the cache. That is, each time a targeted function is invoked, the abstraction will apply a caching behavior checking whether the function has been already executed and its result cached for the given arguments. If it has, then the cached result is returned without having to execute the actual function; if it has not, then function is executed, the result cached and returned to the user so that, the next time the method is invoked, the cached result is returned. This way, expensive functions (whether CPU or IO bound) can be executed only once for a given set of parameters and the result reused without having to actually execute the function again. The caching logic is applied transparently without any interference to the invoker.

See Nebulex.Caching.Decorators for more information about "Declarative annotation-based caching".



Link to this macro

keyref(cache \\ nil, key)

View Source (macro)

A wrapper macro for Nebulex.Caching.Decorators.build_keyref/2.

This macro is imported automatically with use Nebulex.Caching, which means you don't need to do any additional alias or import.

See cacheable/3 decorator for more information about its usage.