I wrote a cache system once, which works like this:
Map should work) if it contains the result data and when the call was made (timestamp)Map, which buffers in-transit request PromisesPromise and store an array with the next item containing refs to the Promise's resolve and reject methods.Promises by calling the correct method from the buffer Map.Map together with a timestamp.Hashing the parameters should be simple, if you JSON-stringify them and then use something like this for the hash:
// stackoverflow.com/a/34842797
const hash = str => str.split('').reduce((prevHash, currVal) =>
(((prevHash << 5) - prevHash) + currVal.charCodeAt(0))|0, 0);