在iOS上,如果diskPath:nil,则存储NSURLCache缓存? [英] On iOS where is the NSURLCache cache stored if diskPath:nil?
问题描述
我遇到的代码如下:
NSURLCache *URLCache =
[[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024
diskCapacity:1024 * 1024 * 5
diskPath:nil];
问题是我无法找到diskPath传递时的预期行为nil 。 NSURLCache docs 没有明确描述这种情况,也没有用我自己的测试来解决这个问题。
The problem is that I haven't been able to find what's the expected behavior when diskPath is passed nil. NSURLCache docs don't explicitly describe this situation nor I have been able to figure it out with my own testing.
缓存存储在哪里?或者该代码是否在错误之上?
Where is the cache stored? or is that code above a bug?
谢谢。
推荐答案
我今天有空闲时间做一些测试并找到答案。没有什么令人兴奋的,但如果你很好奇:
I had some free time today to do some testing and found the answer. Nothing exciting but if you are curious:
默认情况下,iOS将使用名为 Cache.db 的数据库,并且正如@qegal所提到的那样,将是存储在默认位置。
By default iOS will use a database named Cache.db and, as @qegal mentioned, will be stored under the default location.
这篇关于在iOS上,如果diskPath:nil,则存储NSURLCache缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!