Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Deduplicate requests #18

Open
amannn opened this issue Feb 13, 2020 · 0 comments
Open

[FEATURE] Deduplicate requests #18

amannn opened this issue Feb 13, 2020 · 0 comments

Comments

@amannn
Copy link

amannn commented Feb 13, 2020

What / Why

Currently when you request the same URL two times immediately, both hit the network and will resolve with their respective response afterwards.

This happens because the cache manager is only consulted at these two stages:

  1. Before a request is fired off, the cache manager is asked if there is already a response.
  2. After a request is finished, the response will be put inside the cache.

I think it would be helpful if there would be a lookup if a request is already in flight, and if so, return the promise of that request instead of making the same request again.

Note that this should only be the case for idempotent calls – mostly GET. PUT could also work, but the request body needs to be part of the cache identifier then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@amannn and others