Skip to content

Commit

Permalink
Described how to set up persistent disk cache
Browse files Browse the repository at this point in the history
This is good enough "fix" for issue hub4j#168.
  • Loading branch information
kohsuke committed Mar 22, 2015
1 parent 5e08b34 commit e9417f5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/site/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit e9417f5

Please sign in to comment.