简体   繁体   中英

NSUrlCache disk limit?

I am trying to store a large array of images on the server and use AFNetworking 's image caching feature which takes advantage of NSUrlCache , so that the app wouldn't need to hit the server all the time and would even work while offline.

It is important that the images never expire and stay cached forever, so I was wondering if there is a disk limit to how much space the cache can take up to. (For example the cache may expire old images when it hits the limit) thank you!

To check current limit:

 NSLog(@"Disk Limit: %u bytes and converted to MB: %u", [NSURLCache sharedURLCache].diskCapacity, [NSURLCache sharedURLCache].diskCapacity/1024/1024);
 NSLog(@"Memory Limit: %u bytes and converted to MB: %u", [NSURLCache sharedURLCache].memoryCapacity, [NSURLCache sharedURLCache].memoryCapacity/1024/1024);

Create bigger cache use:

- (id)initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity diskPath:(NSString *)path

NSURLRequest handles cache options using NSURLRequestCachePolicy property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM