Class

NSCachedURLResponse

A cached response to a URL request.

Declaration

@interface NSCachedURLResponse : NSObject

Overview

A NSCachedURLResponse object provides the server’s response metadata in the form of a NSURLResponse object, along with an NSData object containing the actual cached content data. Its storage policy determines whether the response should be cached on disk, in memory, or not at all.

Cached responses also contain a user info dictionary where you can store app-specific information about the cached item.

The NSURLCache class stores and retrieves instances of NSCachedURLResponse.

Topics

Creating a Cached URL Response

- initWithResponse:data:

Creates a cached URL response instance.

- initWithResponse:data:userInfo:storagePolicy:

Creates a cached URL response object with a given server response, data, user-info dictionary, and storage policy.

Getting Cached URL Response Properties

data

The cached response’s data.

response

The URL response object associated with the instance.

storagePolicy

The cached response’s storage policy.

userInfo

The cached response’s user info dictionary.

Setting Cache Storage Policies

NSURLCacheStoragePolicy

These constants specify the caching strategy used by an NSCachedURLResponse object.

Relationships

Inherits From

See Also

Cache Behavior

Accessing Cached Data

Control how URL requests make use of previously cached data.

NSURLCache

An object that maps URL requests to cached response objects.