Is there some best practice way to use this that would avoid the following issue:
When you use fetchMethod with max option and get max+1 fetches at the same time, one of the fetches is aborted because it's evicted. This isn't really the behaviour I'd need, it would be fine if I just get the result and after that it's evicted from the cache. Obviously I could stop using fetchMethod and just use get and set, but then I'd also need to handle not firing multiple fetches concurrently for the same key. Meaning that I'd reimplement some of the functionality that already exists in this library. And if I wanted to use staleWhileRevalidate I'd have to implement that one as well instead of using the functionality from lru-cache.
Is there some best practice way to use this that would avoid the following issue:
When you use
fetchMethod
withmax
option and get max+1 fetches at the same time, one of the fetches is aborted because it's evicted. This isn't really the behaviour I'd need, it would be fine if I just get the result and after that it's evicted from the cache. Obviously I could stop usingfetchMethod
and just useget
andset
, but then I'd also need to handle not firing multiple fetches concurrently for the same key. Meaning that I'd reimplement some of the functionality that already exists in this library. And if I wanted to usestaleWhileRevalidate
I'd have to implement that one as well instead of using the functionality from lru-cache.