| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in Mac OS X v10.2 with Safari 1.0 installed. Available in Mac OS X v10.2.7 and later. |
| Companion guide | |
| Declared in | NSURLCache.h |
| Related sample code |
An NSCachedURLResponse object encapsulates an NSURLResponse object, an NSData object containing the content corresponding to the response, and an NSDictionary containing application specific information.
The NSURLCache system stores and retrieves instances of NSCachedURLResponse.
Returns the receiver’s cached data.
- (NSData *)data
The receiver’s cached data.
NSURLCache.hInitializes an NSCachedURLResponse object.
- (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data
The response to cache.
The data to cache.
The NSCachedURLResponse object, initialized using the given data.
The cache storage policy is set to the default, NSURLCacheStorageAllowed, and the user info dictionary is set to nil.
NSURLCache.hInitializes an NSCachedURLResponse object.
- (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data userInfo:(NSDictionary *)userInfo storagePolicy:(NSURLCacheStoragePolicy)storagePolicy
The response to cache.
The data to cache.
An optional dictionary of user information. May be nil.
The storage policy for the cached response.
The NSCachedURLResponse object, initialized using the given data.
NSURLCache.hReturns the NSURLResponse object associated with the receiver.
- (NSURLResponse *)response
The NSURLResponse object associated with the receiver.
NSURLCache.hReturns the receiver’s cache storage policy.
- (NSURLCacheStoragePolicy)storagePolicy
The receiver’s cache storage policy.
NSURLCache.hReturns the receiver’s user info dictionary.
- (NSDictionary *)userInfo
An NSDictionary object containing the receiver’s user info, or nil if there is no such object.
NSURLCache.hThese constants specify the caching strategy used by an NSCachedURLResponse object.
typedef enum
{
NSURLCacheStorageAllowed,
NSURLCacheStorageAllowedInMemoryOnly,
NSURLCacheStorageNotAllowed,
} NSURLCacheStoragePolicy;
NSURLCacheStorageAllowedSpecifies that storage in NSURLCache is allowed without restriction.
Important: iPhone OS ignores this cache policy, and instead treats it as NSURLCacheStorageAllowedInMemoryOnly.
Available in Mac OS X v10.2 and later.
Declared in NSURLCache.h.
NSURLCacheStorageAllowedInMemoryOnlySpecifies that storage in NSURLCache is allowed; however storage should be restricted to memory only.
Available in Mac OS X v10.2 and later.
Declared in NSURLCache.h.
NSURLCacheStorageNotAllowedSpecifies that storage in NSURLCache is not allowed in any fashion, either in memory or on disk.
Available in Mac OS X v10.2 and later.
Declared in NSURLCache.h.
NSURLCache.h
© 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-05-02)