如何实现与毕加索库我自己的磁盘缓存 - 安卓?毕加索、自己的、缓存、磁盘

2023-09-12 02:14:52 作者:〃向日葵的微笑只属于太阳

我使用的是毕加索库加载图像,我的应用程序。但我不如何实现我自己的盘(SD卡)的缓存与毕加索库。请人帮我解决这个问题。

I'm using picasso library to load images for my app. But i don't how to implement my own disk (sdcard) caching with picasso library. Please anybody help me to solve this issue.

推荐答案

毕加索使用HTTP客户端磁盘缓存,如果其中一个已配置它将使用,而不是安装它自己。

Picasso uses the HTTP client for disk caching and if one is already configured it will use that instead of installing its own.

有关内置的​​URLConnection的文档安装高速缓存的位置:的https://developer.android.com/reference/android/net/http/Htt$p$psponseCache.html

For the built-in UrlConnection the docs for installing a cache are here: https://developer.android.com/reference/android/net/http/HttpResponseCache.html

如果您使用的是OkHttp那么你只需要调用setCache: http://square.github.io/okhttp/2.x/okhttp/com/squareup/okhttp/OkHttpClient.html#setCache-com.squareup.okhttp.Cache-

If you are using OkHttp then you just call setCache: http://square.github.io/okhttp/2.x/okhttp/com/squareup/okhttp/OkHttpClient.html#setCache-com.squareup.okhttp.Cache-