【问题标题】:Volley android caching - data is cached even when the max age is 0Volley android缓存 - 即使最大年龄为0,数据也会被缓存
【发布时间】:2014-01-21 05:17:40
【问题描述】:

我使用下面的语句来获取缓存的数据...

mQueue.getCache().get(request.getCacheKey())

我注意到,即使 max age =0,上述语句也能够从缓存中获取数据。是否意味着凌空总是存储网络响应?但是当我厌倦了发出新请求时,数据是从网络中获取而不是缓存。所以我很困惑......

【问题讨论】:

    标签: android caching android-volley


    【解决方案1】:

    始终缓存数据,但会检查过期时间,如果请求过期,则会发出新请求。这样,如果没有数据连接,或者如果您想在网络请求在后台更新时显示一些数据,您甚至可以从缓存中获取数据。

    【讨论】:

      猜你喜欢
      • 2016-05-11
      • 1970-01-01
      • 2011-09-23
      • 1970-01-01
      • 2016-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多