使用okhttp使用多个缓存目录的可能性

发布于 2025-02-09 14:49:35 字数 263 浏览 1 评论 0原文

我想知道OKHTTP是否提供了并行管理多个高速缓存目录的能力以及如何实现它... 我要实现的用例是:

  • 用户浏览随机URL,该URL在Cachedir1中带有驱逐的policy1
  • 用户可以将URL内容保存在Cachedir2中,并使用专用的驱动驱动器2!= evictionPolicy1

加载URL时,OKHTTP会首先看Cache2,然后Cache2,然后CACHE2在缓存1中保存URL内容(如果Cache1或Cache2中还没有存在)

I'm wondering if okHttp offer the ability to manage multiple cache directories in parallel and how to implement it...
Use case I want to implement is :

  • user browse random URL that are cached in cacheDir1 with evictionPolicy1
  • user is able to save URL contents in cacheDir2 with a dedicated evictionPolicy2 != evictionPolicy1

When loading an URL, okHttp will look at cache2 first, then cache1, saving URL content in cache 1 if not already present in cache1 or cache2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

狼性发作 2025-02-16 14:49:35

这在Okhttp中不可用。我建议在另一层做这件事;也许是应用程序拦截器。

This is not available in OkHttp. I recommend doing this at another layer; perhaps an application interceptor.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文