在Android上为OkHttp缓存创建目录?

时间:2015-09-24 01:54:19

标签: android caching okhttp

在Android上,我应该如何为function [y1,y2] = myfun(x1,x2) y1 = x1+x2; y2 = x1^2+x2^2; end 构造函数创建File参数?似乎com.squareup.okhttp.Cache给了你很多选择:

  • Context
  • new File(context.getCacheDir(), "HttpResponseCache")
  • new File(context.getExternalCacheDir(), "HttpResponseCache")

只是想知道最佳做法是什么。谢谢!

1 个答案:

答案 0 :(得分:10)

第一个应该可以很好地工作,并为您的用户提供一个释放磁盘空间的机制。