Created
October 27, 2016 13:47
-
-
Save matdziu/a15372bfbec7040569f3f2c62ca82cf9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class OnlineCacheInterceptor implements Interceptor { | |
| @Override | |
| public okhttp3.Response intercept(Chain chain) throws IOException { | |
| okhttp3.Response response = chain.proceed(chain.request()); | |
| CacheControl cacheControl = new CacheControl.Builder() | |
| .maxAge(30, TimeUnit.SECONDS) | |
| .build(); | |
| return response.newBuilder() | |
| .header("Cache-Control", cacheControl.toString()) | |
| .build(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment