Skip to content

Commit 367fefd

Browse files
authored
Update CacheNetworkInterceptor README with more setup details
1 parent 2b6b330 commit 367fefd

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cache/src/main/java/io/stanwood/framework/network/cache/CacheNetworkInterceptor.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,22 @@
5555
* this library. In the future this might be added to the provided interceptors by means of
5656
* accepting a list of parameter keys instead of just the one of the auth parameter.
5757
*
58-
* <p>Configuration of the interceptor classes is mainly done by means of request headers. Check
59-
* out {@link CacheHeaderKeys} for more details on what the different headers do.
58+
* <p>Configuration of the interceptor classes is mainly done via request headers. Check
59+
* out {@link CacheHeaderKeys} for more details on what the different headers do. Add them to your
60+
* requests like so:
61+
* <pre>
62+
* {@code @Headers({ CacheHeaderKeys.APPLY_RESPONSE_CACHE + ": true" })}
63+
* </pre>
6064
*
61-
* <p>Add it as a network interceptor to your OkHttpClient Builder like so:
65+
* <p>Add instances of this interceptor as a network interceptor to your OkHttpClient Builder like so:
6266
* <pre>
6367
* {@code okHttpClientBuilder.addNetworkInterceptor(new CacheNetworkInterceptor("auth", 3600))}
6468
* </pre>
69+
*
70+
* Don't forget to add a cache to the builder as well:
71+
* <pre>
72+
* {@code okHttpClientBuilder.cache(new Cache(new File(app.cacheDir, "okhttp-storyly-rest-api-cache"), 10 * 1024))}
73+
* </pre>
6574
*/
6675
public class CacheNetworkInterceptor implements Interceptor {
6776

0 commit comments

Comments
 (0)