We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
I just tried SDURLCache and it looks just great. But it seems disk caching is off by default (contrary to what is saif in the comments on the header).
Step to reproduce the problem :
SDURLCache *urlCache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024 // 1MB mem cache diskCapacity:1024*1024*1000 // 1GB disk cache diskPath:[SDURLCache defaultCachePath]]; [NSURLCache setSharedURLCache:urlCache]; [urlCache release];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:fileUrl]]; [request setCachePolicy:NSURLCacheStorageAllowed]; NSCachedURLResponse* cachedMenuResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request]; if(cachedMenuResponse==nil) { AFURLConnectionOperation *operation = [[AFURLConnectionOperation alloc] initWithRequest:request];
- (void)storeCachedResponse:(NSCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request { . . . NSURLCacheStoragePolicy storagePolicy = cachedResponse.storagePolicy; if ((storagePolicy == NSURLCacheStorageAllowed || (storagePolicy == NSURLCacheStorageAllowedInMemoryOnly && _ignoreMemoryOnlyStoragePolicy)) && [cachedResponse.response isKindOfClass:[NSHTTPURLResponse self]] && cachedResponse.data.length < self.diskCapacity) {
Solution :
I solved the problem by forcing ignoreMemoryOnlyStoragePolicy to YES :
SDURLCache *urlCache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024 // 1MB mem cache diskCapacity:1024*1024*1000 // 1GB disk cache diskPath:[SDURLCache defaultCachePath]]; urlCache.ignoreMemoryOnlyStoragePolicy = YES; [NSURLCache setSharedURLCache:urlCache]; [urlCache release];
I think either the comments on the header are wrong or there is a bug.
Thanks, Vincent
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I just tried SDURLCache and it looks just great. But it seems disk caching is off by default (contrary to what is saif in the comments on the header).
Step to reproduce the problem :
Solution :
I solved the problem by forcing ignoreMemoryOnlyStoragePolicy to YES :
I think either the comments on the header are wrong or there is a bug.
Thanks,
Vincent
The text was updated successfully, but these errors were encountered: