安卓+毕加索:改变URL缓存过期 [英] Android + Picasso: changing URL cache expiration

查看:196
本文介绍了安卓+毕加索:改变URL缓存过期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的毕加索下载并显示在视图中图像的所有accros我的应用程序。这些图像变化很少(他们被认为是有效的几个月)。

I am using Picasso to download and display images in views all accros my application. Those images are changing very rarely (they are considered valid for a few months).

有没有问毕加索一个简单的方法(或底层okHttp),以确保光盘上的图像,这多少时间?

Is there a simple way to ask Picasso (or the underlying okHttp) to keep those images on disc for this much time?

推荐答案

磁盘缓存发生下面的毕加索HTTP客户端里面。实际上,这个过程是完全透明的。我们从来没有明确要求缓存的版本或网络版,HTTP客户端将在内部决策和做正确的事情。

Disk caching happens "below" Picasso inside the HTTP client. In fact, this process is completely transparent. We never explicitly ask for a cached-version or an internet-version, the HTTP client will make the decision internally and do the right thing.

由于我们选择利用HTTP客户端的缓存中,我们提供了非常少的控制缓存实际上如何发生的。要回答你的问题,没有,没有办法告诉毕加索(或OkHttp)缓存图像的时间超过其头部允许。

Because we opted to leverage the HTTP client for caching, we're offered very little control over how the caching actually happens. To answer your question, no, there is no way to tell Picasso (or OkHttp) to cache an image for longer than its headers allow.

这篇关于安卓+毕加索:改变URL缓存过期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆