memoize
memoize copied to clipboard
Memoizing synchronous methods
I would like to use your library to address the dog piling problem.
Currently, I use caches with both sync and async methods. I know I could convert sync methods to async, but I like how purely sync methods can be identified currently and would like your thought on how to do this with your library.
In sync flow (no concurrency) there is no risk of dogpiling. Still, I guess that you'd like to use a single solution for caching.
The main focus of this lib is to work with async and to deal with dogpiling. The current logic is strongly asynchronous. If I'd to develop a mode for working with sync, then it would basically do what you mentioned - convert between sync and async on-top of current logic.
Introducing such a mode would be no better than doing the conversion in the client code - so the recommendation would be to stick with the conversion you mentioned.