Creates a function that memoizes the result of a given function.

The cache key is determined by the resolver or by the arguments from the function call.


  • resolver A function that determines the cache key based on the arguments provided.
  • ttl the time to live for the cache entries in milliseconds.


  • cache The cache is an instance of Map and can be used to clear or inspect the cache. It can be replaced by a custom cache that matches the Map interface.

This function can be used as a decorator with decMemoize.