View Source Nebulex.Caching (Nebulex v2.6.1)
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.
Nebulex.Caching.Decorators for more information about
"Declarative annotation-based caching".
A wrapper macro for
This macro is imported automatically with
which means you don't need to do any additional
cacheable/3 decorator for more information about its usage.