Closed
Description
Hi there
Awesome library. I have one question though:
It seems like you're appending random query strings to the end of every API call, probably in order to make sure you get a non-cached response on every call.
However, the Gihub API implements a pretty smart HTTP caching, that is being ignored with this library. For people using it, it means that the rate-limit will get used much faster, and apps will try to reload content that is not updated.
Here's an example of what I mean:
/* Using JQuery
____________________________________________ */
$.ajax({
url:"https://user:pass@api.github.com/repos/user/repo",
success: function(data) { console.log(data) }
});
// --> response 200 with content
$.ajax({
url:"https://user:pass@api.github.com/repos/user/repo",
success: function(data) { console.log(data) }
});
// --> if called again within 60 seconds this call will never be made,
// as the Github API has HTTP cache of 60 seconds. If after
// 60 seconds and data is not updated, it returns an empty
// 304 not modified, which is much faster
/* Using github.js
____________________________________________ */
var github = new Github({
username: "user",
password: "pass",
auth: "basic"
});
var repo = github.getRepo(user, repo);
repo.show(function(err, repo) { console.log(repo) });
// --> response 200 with content
repo.show(function(err, repo) { console.log(repo) });
// --> response 200 with content, no caching
repo.show(function(err, repo) { console.log(repo) });
// --> response 200 with content, no caching
I saw that you have "implemented smart caching" in a commit, so I'm not sure exactly what's going on. How is this library caching stuff?