I have been using retrofit1 + robospice to make API requests. You can check sample here. In this framework, I used to make request like this
getSpiceManager().execute(request, CACHE_KEY, DurationInMillis.ONE_MINUTE(CACHE_TIME), new ResponseListener());
Above statement will make sure that it will return the cached response for one minute from the time I requested(with the same cache key).But currently, robospice does not support retrofit v2. My Question is that is there any cache mechanism for retrofit v2 to implement like this. I googled for some time but I could not find what exactly I want.
the proper way to cache responses in android is using OkHttp (and it combines with Retrofit as well) use the cache method :