android - 使用 Google 的 Volley 设置缓存的过期策略

标签 android android-volley

是否可以修改 Google 的 Volley 库中缓存的过期策略?我相信您可以实现自己的缓存,但是有没有一种简单的方法可以使用默认实现来做到这一点?

最佳答案

无需编写自己的缓存实现。您可以更改方法 com.android.volley.toolbox.HttpHeaderParser.parseCacheHeaders(NetworkResponse response),忽略这些 header ,将 entry.softTtl 和 entry.ttl 字段设置为适合您的任何值,并在您的请求类中使用您的方法。

我对类似问题的回答中有一个示例 - Android Volley + JSONObjectRequest Caching

关于android - 使用 Google 的 Volley 设置缓存的过期策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16783177/

相关文章:

php - 将服务器 URL 链接安全地存储在 android 应用程序中

android - 将 Android volley 导入 Android Studio

java - 我怎样才能在android中的URL中停留更长时间的响应?

android - Fixed Size ImageView 显示不同大小的图像

android - 计数器在线程中运行,由 Arduino 信号驱动,跳过前几个数字

android - 文本颜色更改未反射(reflect)在 ListView 中

android Json Volley 如何创建界面

java - 安卓 Volley : where add retry policy and timeout?

javascript - 如何在我的 Web View Android 应用程序中使用 Polymer 项目

java - 如何在 Android 中将字符串化数组转换为 ArrayList