enum { NSURLRequestUseProtocolCachePolicy = 0, NSURLRequestReloadIgnoringLocalCacheData = 1, NSURLRequestReloadIgnoringLocalAndRemoteCacheData =4, NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData, NSURLRequestReturnCacheDataElseLoad = 2, NSURLRequestReturnCacheDataDontLoad = 3, NSURLRequestReloadRevalidatingCacheData = 5 }; typedef NSUInteger NSURLRequestCachePolicy;
NSURLRequestReturnCacheDataElseLoad
Specifies that the existing cached data should be used to satisfy the request, regardless of its age or expiration date. If there is no existing data in the cache corresponding the request, the data is loaded from the originating source.
Example of [NSURLRequest NSURLRequestReturnCacheDataElseLoad]
NSString *urlString = [NSString stringWithFormat:@"http://test.localhost/api/request.php?url=%@", passedValue]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy: NSURLRequestReturnCacheDataElseLoad timeoutInterval:15.0];
Example of [NSURLRequest NSURLRequestReturnCacheDataElseLoad]
NSURLRequest *lRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:link] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0];