我正在使用Retrofit和OkHttp客户端进行网络呼叫。我的服务器支持Etag缓存,并且我已经向okHttp
客户端添加了缓存。有一些API我不想缓存
这是我的okHttpClient
配置
OkHttpClient okHttpClient(Context context,
HttpLoggingInterceptor loggingInterceptor,Cache okHttpCache) {
final OkHttpClient.Builder builder = new OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.cache(okHttpCache)
return builder.build();
}
Cache cache(Context context) {
return new Cache(new File(context.getCacheDir(), "cache"),10 * 1024 * 1024);
}
我可以忽略缓存中的一些API吗?
https://stackoverflow.com/questions/47590521
复制