How to implement my own disk cache with picasso library - Android?

后端 未结 2 1834
一向
一向 2020-11-27 19:00

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.

2条回答
  •  执笔经年
    2020-11-27 19:35

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

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

    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-

提交回复
热议问题