Echo JS 0.11.0

<~>

chrispanag comments

chrispanag 1295 days ago. link 1 point
I agree with you about the stringification :)

This mostly oriented towards NodeJS. It's not data caching, it's promise-caching. 

A small excerpt from the article where it clarifies the use case for this:

User Bob, needs some data, so your system performs a request to the third-party API, and waits for a response. In the meantime, user Alice needs the same date and the system performs the same request to the API on behalf of her. Both users are now waiting for two requests that the only difference they have, is the execution time.

If a request to this API has an average response time of 1 second, both users will wait 1 second. Also, you would need to occupy resources in your system and the third-party API for more than 1 second, and for 2 seconds at most!

What if you could have both users, Bob and Alice, wait for the same request? Then, although Bob will still wait for the request for 1 second, Alice will use Bob's request, and wait less time for the response.

To achieve that, we'll need a promise-cache subsystem. This subsystem will consist of a data structure to store our requests' promises and of a way to retrieve them/delete them when they are not needed.