Mastodon Personal Mastodon

Caching with Memoization and the Singleton Pattern

Caching with Memoization and the Singleton Pattern
Photo by Namroud Gorguis / Unsplash
READING TIME: 1MIN

Reading this article on memoization which is the best explanation I've come across.

So it's caching using a function or object to store expensive computations in memory.

I think we could use a Singleton for this right?

UPDATE

After doing further research, a Singleton might not be the best pattern to use for Memoizing a function.

Also, a really great look at memoization and its performance metrics by Addy Osmani.