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

Cache calls to a given URL #5

Open
jamesfoster opened this issue Jun 30, 2014 · 1 comment
Open

Cache calls to a given URL #5

jamesfoster opened this issue Jun 30, 2014 · 1 comment

Comments

@jamesfoster
Copy link

The first call to agent.get() should store the response (or the parsed result) and subsequent calls should return the cached result.

Perhaps supply a .refresh() or .reset() method to delete the cache?!

@DracoBlue
Copy link
Owner

If you are using the client in a browser, you will have the caching behavior of the browser. This works really great. Given that your server sends proper Cache-Control-Headers, you will for example easily fetch a latest version only if the server wants you to fetch it (with If-Not-Modified-Headers and 403 Not Modified responses).

But it could be helpful to add an extra cache, if the server is not under control of the client.

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