mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Described how to set up persistent disk cache
This is good enough "fix" for issue #168.
This commit is contained in:
@@ -41,4 +41,11 @@ This library comes with a pluggable connector to use different HTTP client imple
|
||||
through `HttpConnector`. In particular, this means you can use [OkHttp](http://square.github.io/okhttp/),
|
||||
so we can make use of it's HTTP response cache.
|
||||
Making a conditional request against the GitHub API and receiving a 304 response
|
||||
[does not count against the rate limit](http://developer.github.com/v3/#conditional-requests).
|
||||
[does not count against the rate limit](http://developer.github.com/v3/#conditional-requests).
|
||||
|
||||
The following code shows an example of how to set up persistent cache on the disk:
|
||||
|
||||
Cache cache = new Cache(cacheDirectory, 10 * 1024 * 1024); // 10MB cache
|
||||
GitHub gitHub = GitHubBuilder.fromCredentials()
|
||||
.withConnector(new OkHttpConnector(new OkUrlFactory(new OkHttpClient().setCache(cache))))
|
||||
.build();
|
||||
|
||||
Reference in New Issue
Block a user