Closed papjul closed 1 year ago
Hum, good http client library usually handles that for you. The request will be cached until the Expires value, and any identical requests issued will just return the cached response immediately.
I'm not familiar with Android API, but this looks like this could do the job ? (2min googlefu, may be wrong :D) https://developer.android.com/reference/android/net/http/HttpResponseCache
We use the Retrofit dependency to ease API handling. According to my HTTP interceptor, it makes a new request everytime.
I see, OkHttpClient (which is used by Retrofit) supports caching, and from what I can see here the cache is not enabled: https://github.com/WangDaYeeeeee/GeometricWeather/blob/master/app/src/main/java/wangdaye/com/geometricweather/common/retrofit/TLSCompactHelper.java#L90
I can do some tests locally and issue a PR
Fixed in #440
Hi,
Many weather providers request that developers should/must comply with the Expires HTTP header.
The Expires header contains the date/time after which data will be updated on server side. Until then, it is useless (and harmful for the bandwidth) to refresh.
As per AccuWeather guidelines:
This is also a prerequisite for #242
Would it be possible to make sure data is not refreshed until that date? This would apply to:
This would also save up some precious API calls from useless refreshes, as seen in #223.