简体   繁体   中英

Android caching network response for certain time limit

I am currently using HttpClient to perform a network request which returns a JSON object. I would like to cache the data that comes back and set an expiration of ten minutes to that cached data.

I have looked into using LruCache, SQLite, and shared preferences. Which would be the best way to perform this task? I am currently using an SQLite database for other parts of my app, so I was just thinking about using that and comparing the timestamp when the data was cached. That option will work for me, but seems like overkill since there will always only be one row in that table.

Any suggestions will be helpful. Thanks!

共享的首选项非常简单,足以满足您的需求。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM