Skip to content

Commit e9417f5

Browse files
committed
Described how to set up persistent disk cache
This is good enough "fix" for issue hub4j#168.
1 parent 5e08b34 commit e9417f5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/site/markdown/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,11 @@ This library comes with a pluggable connector to use different HTTP client imple
4141
through `HttpConnector`. In particular, this means you can use [OkHttp](http://square.github.io/okhttp/),
4242
so we can make use of it's HTTP response cache.
4343
Making a conditional request against the GitHub API and receiving a 304 response
44-
[does not count against the rate limit](http://developer.github.com/v3/#conditional-requests).
44+
[does not count against the rate limit](http://developer.github.com/v3/#conditional-requests).
45+
46+
The following code shows an example of how to set up persistent cache on the disk:
47+
48+
Cache cache = new Cache(cacheDirectory, 10 * 1024 * 1024); // 10MB cache
49+
GitHub gitHub = GitHubBuilder.fromCredentials()
50+
.withConnector(new OkHttpConnector(new OkUrlFactory(new OkHttpClient().setCache(cache))))
51+
.build();

0 commit comments

Comments
 (0)