Caching network response for a request in Android app for a period of 1 day using retrofit

Viewed 206

I want to Cache Network Response for a particular request for a period of 1 day, before I can force a network call. is using Cache-Control the best way for this.

1) The response for which i want to cache has this cache-control: max-age=86400 in header response , will this suffice for automatically storing the response in cache and not making network call for 1 day.

2) Is forcing a network call meaning to do ("Cache-Control","no-cache")

3) If I want to clear cache on logout is this correct getContext().cacheDir.deleteRecursively()

Any comments and suggestions will be useful.

0 Answers
Related