Module: Functional::Memo

Defined in:
lib/functional/memo.rb

Overview

Note:

Memoized method calls are thread safe and can safely be used in concurrent systems. Declaring memoization on a function is not thread safe and should only be done during application initialization.

Memoization is a technique for optimizing functions that are time-consuming and/or involve expensive calculations. Every time a memoized function is called the result is caches with reference to the given parameters. Subsequent calls to the function that use the same parameters will return the cached result. As a result the response time for frequently called functions is vastly incresed (after the first call with any given set of) arguments, at the cost of increased memory usage (the cache).

Since:

  • 1.0.0