yale8848 / RetrofitCache

RetrofitCache让retrofit2+okhttp3+rxjava配置缓存如此简单。通过注解配置,可以针对每一个接口灵活配置缓存策略;同时让每一个接口方便支持数据模拟,可以代码减小侵入性,模拟数据可以从内存,Assets,url轻松获取。
MIT License
676 stars 85 forks source link

@cache没加,断网还是加载缓存数据。 #11

Closed MichealWangDan closed 6 years ago

MichealWangDan commented 6 years ago

登录接口断网是不希望走缓存的,但是断网还是读取缓存,怎么弄? @GET("center/inf4User/fakeLogin") Observable<ApiResponse> login(@Query("username") String username, @Query("password") String password);

yale8848 commented 6 years ago

你看看这个接口返回的header里是不是加缓存相关字段了?

MichealWangDan commented 6 years ago

Request Method:GET Status Code:200 OK Request Headers Provisional headers are shown Accept-Encoding:gzip Connection:Keep-Alive If-Modified-Since:Sat, 20 Jan 2018 05:53:50 GMT User-Agent:okhttp/3.8.0 Query String Parametersview sourceview URL encoded Response Headers Content-Type:text/html;charset=UTF-8 Date:Mon, 22 Jan 2018 02:34:11 GMT Server:Apache-Coyote/1.1 Transfer-Encoding:chunked

哪些是的?怎么去除?

yale8848 commented 6 years ago

哦 目前断网默认是直接从缓存拿数据的,如果你有断网不走缓存数据的需求的话,我下版本添加接口配置

MichealWangDan commented 6 years ago

可以,期待下个版本

yale8848 commented 6 years ago

更新至1.0.6 forceCacheNoNet=false

MichealWangDan commented 6 years ago

好的,谢谢!