Memoized

This package adds a defmemoized macro to Elixir. This is used to define a function that should be memoized - this means that after the first time it is called with a particular set of arguments, the result is stored and never recomputed.

The cache is local to the current process. Note that there are no expiration strategies or ways to remove entries from the cache; the cache will exist for the lifetime of the process. That makes this useful for shortlived processes like Phoenix Liveviews.

Warning!

Installation

If available in Hex, the package can be installed by adding memoized to your list of dependencies in mix.exs:

def deps do
  [
    {:memoized, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/memoized.