NSURLRequest cache policy enum
I'm creating a url request as follows:
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:1
timeoutInterval:5];
Referring to the developer documentation for the cache policy, I read the
following:
enum
{
NSURLRequestUseProtocolCachePolicy = 0,
NSURLRequestReloadIgnoringLocalCacheData = 1,
NSURLRequestReloadIgnoringLocalAndRemoteCacheData =4,
NSURLRequestReloadIgnoringCacheData =
NSURLRequestReloadIgnoringLocalCacheData,
NSURLRequestReturnCacheDataElseLoad = 2,
NSURLRequestReturnCacheDataDontLoad = 3,
NSURLRequestReloadRevalidatingCacheData = 5
};
typedef NSUInteger NSURLRequestCachePolicy;
So what is the proper way to declare the cachePolicy for the NSURLRequest?
Shall I define it as:
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:1
timeoutInterval:5];
Or shall I define it as:
NSURLRequest *request = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
Both seem to work but is one approach better than the other?
No comments:
Post a Comment