0

I'm making an app that uses an API service with a very short limit, so the only solution is to keep cache for every loaded URL.

I think it's a requirement to do it manually instead regular okhttp/android http cache because the server response for all my requests is X-Cache: MISS. I found this post about it with an answer i think It't the right way to do it:

Good way to cache data during Android application lifecycle?

But the answer is very old, so maybe I'm missing something important or there is a new way to do it.

Thanks in advance for your answers.

Community
  • 1
  • 1
Motheus
  • 533
  • 5
  • 21

1 Answers1

1

consider 2-level caching -

  • first level with memory, in your application context. That link you provided addresses this, though its old, its message is relevant still.

  • 2nd level with local storage via sqlite. Consider implementing a content provider for this. Leave the job of talking to your backend server to this. Have methods to invalidate the cache, and other customizations. See third party libraries like robspice or android-atleap

ashoke
  • 6,441
  • 2
  • 26
  • 25