NSURLCache *cache = [NSURLCache sharedURLCache];
cache.memoryCapacity = 2 * 1024 * 1024;
cache.diskCapacity = 20 * 1024 *1024;
NSCachedURLResponse *response = [cache cachedResponseForRequest:request];
if (response) {
// NSLog(@"data:%@", response.data);
id cacheResult = [NSJSONSerialization JSONObjectWithData:response.data options:NSJSONReadingMutableContainers error:nil];
NSLog(@"cacheResult: %@", cacheResult);
}
时间: 2024-12-28 21:47:46