SmartCache icon indicating copy to clipboard operation
SmartCache copied to clipboard

Any way to force refresh?

Open gregdev opened this issue 6 years ago • 2 comments

Is there any way to force a particular URL to be fetched from the web again and update the cache with the result, or to purge a URL from the cache?

My app includes pull down to refresh - when this is used I'd like to invalidate the cache, fetch data from the server, and update the cache with the new data.

gregdev avatar Sep 12 '18 04:09 gregdev

public void onResponse(Call<List<Brand>> call, Response<List<Brand>> response) { if(!response.raw().request().url().host().equalsIgnoreCase("localhost")) { //from Cache }else{ //from server } }

marutichintan avatar Dec 01 '18 20:12 marutichintan

Hey, I added a way to check if cache is used: SmartCache.isResponseFromNetwork() that you can use in your callback. Cache can be cleared as well, you can check the new demo app I added.

To install the new version change the implementation line in Gradle, as mentioned in the README. The username/owner of the repo is changed as well.

fikisipi avatar Apr 26 '21 12:04 fikisipi