如果服务器没有发送响应缓存标头"缓存控制"如何在Android应用中缓存响应

时间:2017-08-08 14:58:36

标签: android caching

我需要为我的Android应用程序实现缓存,Server Response包含TTL值,该值表示何时再次获取数据。目前,我正在使用Retofit获取服务器响应和OKHTTP3。这是我的服务器JSON响应,有人可以将我链接到任何第三方库或任何实现此功能的指南是在Android

{
"ttl": 5,
"status": "ok",
"source": "techcrunch",
"sortBy": "top",
-"articles": [
-{
"author": "Romain Dillet",
"title": "Apple just released iOS 11 developer beta 5",
"description": "Apple just dropped a brand new beta for your favorite iOS update of the year. While iOS 11 isn’t coming out until September, the company has been testing..",
"url": "https://techcrunch.com/2017/08/07/apple-just-released-ios-11-developer-beta-5/",
"urlToImage": "https://tctechcrunch2011.files.wordpress.com/2017/06/ios-11-preview-5.jpg?w=764&h=400&crop=1",
"publishedAt": "2017-08-07T17:08:08Z"
},
-{
"author": "Megan Rose Dickey",
"title": "Uber discloses details of Travis Kalanick’s deposition in Waymo lawsuit",
"description": "Uber unsealed former CEO Travis Kalanick's deposition in the Uber versus Waymo self-driving car technology case over the weekend. Kalanick, who was deposed..",
"url": "https://techcrunch.com/2017/08/07/uber-discloses-details-of-travis-kalanicks-deposition-in-waymo-lawsuit/",
"urlToImage": "https://tctechcrunch2011.files.wordpress.com/2017/08/gettyimages-543263066.jpg?w=764&h=400&crop=1",
"publishedAt": "2017-08-07T16:52:39Z"
},
-{
"author": "Jordan Crook",
"title": "The battle between hotels and Airbnb escalates in NYC",
"description": "The war between Airbnb and the hotel industry rages on, and it's reaching new lows here in New York. A campaign, backed by the Hotel Association of New York..",
"url": "https://techcrunch.com/2017/08/07/the-battle-between-hotels-and-airbnb-escalates-in-nyc/",
"urlToImage": "https://tctechcrunch2011.files.wordpress.com/2017/08/gettyimages-169277082.jpg?w=764&h=400&crop=1",
"publishedAt": "2017-08-07T15:25:29Z"
},
-{
"author": "Romain Dillet",
"title": "iPhone 8 could scan your face even if your phone is on a table",
"description": "Apple’s HomePod firmware is the gift that keeps on giving. When the company shared an early build of the speaker firmware, many developers started digging..",
"url": "https://techcrunch.com/2017/08/07/iphone-8-could-scan-your-face-even-if-your-phone-is-on-a-table/",
"urlToImage": "https://tctechcrunch2011.files.wordpress.com/2017/06/2016-iphone-7-gettyimages-599948224.jpg?w=764&h=400&crop=1",
"publishedAt": "2017-08-07T14:02:43Z"
}
]
}

0 个答案:

没有答案