安卓+毕加索:改变URL缓存过期毕加索、缓存、URL

由网友(殘愛)分享简介:我使用的毕加索下载并显示在视图中图像的所有accros我的应用程序。这些图像变化很少(他们被认为是有效的几个月)。 I am using Picasso to download and display images in views all accros my application. Those images ar...

我使用的毕加索下载并显示在视图中图像的所有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.

阅读全文

相关推荐

最新文章