diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 3c2af0197..ccd0c9cf3 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -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). \ No newline at end of file +[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();