NSCachedURLResponse Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Availability | Available in OS X v10.2 with Safari 1.0 installed. Available in OS X v10.2.7 and later. |
| Companion guide | |
| Declared in | NSURLCache.h |
Overview
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.
Instance Methods
data
Returns the receiver’s cached data.
Return Value
The receiver’s cached data.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.hinitWithResponse:data:
Initializes an NSCachedURLResponse object.
Parameters
- response
The response to cache.
- data
The data to cache.
Return Value
The NSCachedURLResponse object, initialized using the given data.
Discussion
The cache storage policy is set to the default, NSURLCacheStorageAllowed, and the user info dictionary is set to nil.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.hinitWithResponse:data:userInfo:storagePolicy:
Initializes an NSCachedURLResponse object.
Parameters
- response
The response to cache.
- data
The data to cache.
- userInfo
An optional dictionary of user information. May be
nil.- storagePolicy
The storage policy for the cached response.
Return Value
The NSCachedURLResponse object, initialized using the given data.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
See Also
Declared In
NSURLCache.hresponse
Returns the NSURLResponse object associated with the receiver.
Return Value
The NSURLResponse object associated with the receiver.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.hstoragePolicy
Returns the receiver’s cache storage policy.
Return Value
The receiver’s cache storage policy.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.huserInfo
Returns the receiver’s user info dictionary.
Return Value
An NSDictionary object containing the receiver’s user info, or nil if there is no such object.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.hConstants
NSURLCacheStoragePolicy
These constants specify the caching strategy used by an NSCachedURLResponse object.
typedef enum
{
NSURLCacheStorageAllowed,
NSURLCacheStorageAllowedInMemoryOnly,
NSURLCacheStorageNotAllowed,
} NSURLCacheStoragePolicy;
Constants
NSURLCacheStorageAllowedSpecifies that storage in
NSURLCacheis allowed without restriction.Important: iOS prior to version 5 ignores this cache policy, and instead treats it as
NSURLCacheStorageAllowedInMemoryOnly.Available in OS X v10.2 and later.
Declared in
NSURLCache.h.NSURLCacheStorageAllowedInMemoryOnlySpecifies that storage in
NSURLCacheis allowed; however storage should be restricted to memory only.Available in OS X v10.2 and later.
Declared in
NSURLCache.h.NSURLCacheStorageNotAllowedSpecifies that storage in
NSURLCacheis not allowed in any fashion, either in memory or on disk.Available in OS X v10.2 and later.
Declared in
NSURLCache.h.
Availability
- Available in OS X v10.2 with Safari 1.0 installed.
- Available in OS X v10.2.7 and later.
Declared In
NSURLCache.h© 2012 Apple Inc. All Rights Reserved. (Last updated: 2012-05-14)