Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to force refresh? #10

Open
gregdev opened this issue Sep 12, 2018 · 2 comments
Open

Any way to force refresh? #10

gregdev opened this issue Sep 12, 2018 · 2 comments

Comments

@gregdev
Copy link

gregdev commented Sep 12, 2018

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.

@marutichintan
Copy link

marutichintan commented Dec 1, 2018

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

@fikisipi
Copy link
Owner

fikisipi commented Apr 26, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants