decMemoize

Memoizes the decorated function.
The cache key is either determined by the provided resolver or by the arguments used in the memoized function.

Options:

  • resolver A function that determines the cache key for storing the result based on the arguments provided.
  • ttl sets the time to live for the cache in milliseconds. After ttl milliseconds, the next call to the memoized function will result in a cache miss.

Look at memoize for the non-decorator version.

Example