gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 23:09:59 26 4
gpt4 key购买 nike

是否可以修改 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com