简体   繁体   English

Volley Android缓存-即使最大使用期限为0,也将缓存数据

[英]Volley android caching - data is cached even when the max age is 0

I used the following statement to fetch the cached data ... 我使用以下语句来获取缓存的数据...

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

I noted that even when max age =0 the above statement was able to fetch the data from the cache . 我注意到,即使当max age = 0时,上述语句也能够从缓存中获取数据。 Does the means volley always stores the network response ?But when I tired to make a new request data is fetched from network and not cache .So I am confused ... 齐射是否总是存储网络响应?但是当我厌倦了提出新请求时,数据是从网络中获取而不是缓存的,所以我很困惑...

Data is always cached, but the expiration is checked, and a new request it's made if the request is expired. 数据始终会被缓存,但是会检查到期时间,如果请求已过期,则会发出一个新请求。 This way you can get data from the cache even expired if there's no data connectivity or if you want to show some data while the network request update in the background. 这样,如果没有数据连接,或者要在后台网络请求更新时显示一些数据,您甚至可以从缓存中获取数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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