Closed asadi110 closed 7 years ago
Sorry for late answer, just disconnected the weekend.
Your method is a @POST method, if i have understood your code correctly. Cache only works for @GET.
Why would you want to cache a POST if i might know?
Thanks for your response. Although it's not right ,all web services are implemented as @POST methods in server side and data will be backed in response of @POST methods.
I don't think this is a proper behaviour but you can implement it for your use just changing/adding the behaviour in the CachedCallImpl class. Also i don't know if the behavior will work correctly.
Thanks.
hi, thanks for your easy and clean library . I configured my project according to your guide, but cache is not working and services are called in online mode and no response is backed in offline mode. and no error occurred. 1: @FormUrlEncoded @POST("rest/") CachedCall<GeneralResult>
getAvatar(
@Field("method") ServiceType method,
@Field("user_name") String userName);
2:
DualCache<String, byte[]> mCache = RetroCache.getDualCache(MyApplication.context,BuildConfig.VERSION_CODE);
3:
mRetrofitClient = new Retrofit.Builder()
.baseUrl(ClientConfigs.REST_API_BASE_URL)
.client(client)
.addConverterFactory(GsonConverterFactory.create(gson))
.addCallAdapterFactory(new CachedCallFactory(mCache))
.build();
4:
CachedCall<GeneralResult> call =
tService.getAvatar(ServiceType.GetAvatar, pref.getStudyCode());
... pleas help me.tnx