【发布时间】:2016-07-14 16:28:24
【问题描述】:
我正在使用Volley 库在我的新闻应用程序中进行缓存。我想在第一次运行时缓存所有新闻,然后每次打开应用程序时都会显示我的应用程序中的新新闻计数。为此,我再次获取所有数据并将其与我的缓存数据进行比较。有没有其他方法可以获取与我的缓存相比新的部分数据?
【问题讨论】:
标签: android caching android-volley
我正在使用Volley 库在我的新闻应用程序中进行缓存。我想在第一次运行时缓存所有新闻,然后每次打开应用程序时都会显示我的应用程序中的新新闻计数。为此,我再次获取所有数据并将其与我的缓存数据进行比较。有没有其他方法可以获取与我的缓存相比新的部分数据?
【问题讨论】:
标签: android caching android-volley
访问volley缓存中的数据。你可以这样做。
if(Requestqueue.getCache().get(YourUrl)!=null){
//if the response is already cached you can access it from cache
String cachedResponse = new String(Requestqueue.getCache().get(YourUrl).data);
//Here you can write your code to compare your new data with your cached Data.
}
我希望这会有所帮助。谢谢。
【讨论】: