Limited caching of memoized functions with a LRU cache.