使用okhttp使用多个缓存目录的可能性
我想知道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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这在Okhttp中不可用。我建议在另一层做这件事;也许是应用程序拦截器。
This is not available in OkHttp. I recommend doing this at another layer; perhaps an application interceptor.