News for hackers. Stuff that matters.
Re:Ask HN: What are some cool but obscure data structures yo... by hmm-interesting on Friday July 22, 2022 @02:01PM (#32195116)
can you please explain this a bit more how this avoid fetching the same value twice? maybe with example.
Re:Ask HN: What are some cool but obscure data structures yo... by kube-system on Friday July 22, 2022 @03:04PM (#32195877)
It sounds like, if you have a process that takes a long time to do, you check to see if you already have initiated that process (see if the key is in the list of promises), rather than firing off another promise for the same request.

If you get 10 requests to fire function lookUpSomethingThatTakesAWhile(id) that returns a promise, rather than firing off 10 promises, you fire it off once, look up the ID in your map for the next nine, and return that same promise for the next 9.