Wednesday, May 1, 2013

NSURLRequest cachePolicy example ios


cachePolicy

Returns the receiver’s cache policy.
- (NSURLRequestCachePolicy)cachePolicy
Return Value of [NSURLRequest cachePolicy]
The receiver’s cache policy.
Example of [NSURLRequest cachePolicy]
NSURLRequest *request = [NSURLRequest requestWithURL:url
      cachePolicy:NSURLRequestReloadIgnoringCacheData
      timeoutInterval:60.0];

Example of [NSURLRequest cachePolicy]
enum
{
   NSURLRequestUseProtocolCachePolicy = 0,
   NSURLRequestReloadIgnoringLocalCacheData = 1,
   NSURLRequestReloadIgnoringLocalAndRemoteCacheData =4,
   NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,
   NSURLRequestReturnCacheDataElseLoad = 2,
   NSURLRequestReturnCacheDataDontLoad = 3,
   NSURLRequestReloadRevalidatingCacheData = 5
};
typedef NSUInteger NSURLRequestCachePolicy
NSURLRequest *request = [NSURLRequest requestWithURL:baseURL cachePolicy:0 timeoutInterval:10];
self.urlConnection = [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];