gpt4 book ai didi

android - 检查缓存 picasso 中是否存在图像

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:41:18 25 4
gpt4 key购买 nike

我想检查图像 url 是否包含在缓存中。我正在使用 Picasso 图像加载器。

这是我的代码

new Picasso.Builder(this).downloader(new OkHttpDownloader(client)).build();

现在 Picasso.getCache() 没有 get(key)

虽然 Cache 类在内部使用 LRUDiskCache 但它的 private

有什么想法吗??

最佳答案

Jake 已经在 Twitter ( https://twitter.com/JakeWharton/status/679403330809028608 ) 上回答了这个问题,但我在这里重新发布答案以提高可见性。

You could make a request with a network policy of OFFLINE and if it fails then the image is not in the disk cache.

关于android - 检查缓存 picasso 中是否存在图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34417976/

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