AlbinoDrought / cachios

Simple axios cache wrapper using node-cache
MIT License
88 stars 10 forks source link

Deduplicate simultaneous requests #44

Closed cheapsteak closed 5 years ago

cheapsteak commented 5 years ago

Hi

Currently, if multiple axios requests are triggered on the same resource in the same event loop, it will trigger multiple http requests

It would be great if that could be deduplicated

AlbinoDrought commented 5 years ago

Confirmed, added a (currently failing) testcase: https://github.com/AlbinoDrought/cachios/commit/5277d1f1c69f0a9dc5296e89746db19548869137

A little funky since I thought this was previously covered and worked, but apparently not.

cheapsteak commented 5 years ago

Daaaamn that was quick

AlbinoDrought commented 5 years ago

Pushed 2.1.0 that deduplicates these requests: https://www.npmjs.com/package/cachios

:)