For Android Apps, is it possible to set different caching times for different urls using OkHttpClient?
for example, I have two urls:
for the first url, i would like to set caching for 365 days:
Request request = new Request.Builder()
.cacheControl(new CacheControl.Builder()
.maxStale(365, TimeUnit.DAYS)
.build())
.url("http://www.example.com/getcountries.php")
.build();
for the second url, i would like to set caching for 3 minutes:
Request request = new Request.Builder()
.cacheControl(new CacheControl.Builder()
.maxStale(3, TimeUnit.MINUTES)
.build())
.url("http://www.example.com/getnews.php")
.build();
will it work? (with caching in place, debugging is difficult).
Thanks for your support.