Search code examples
androidretrofitdiskcache

How to handle disk cache while use Retrofit?


I wanna to cache my data which request by Retrofit,but i don't know how to implement it.

As we know read/write cache is time-consumed,and we should not do it in main thread.

Does anybody can tell me how should i do to cache my data with Retrofit?Thanks!


Solution

  • Retrofit itself doesn't cache your data. You can use orm libraries to do it without much work.

    Lately I've used Realm, that has a section in their docs specifically for Retrofit.