Inherits from NSObject
Declared in RKRequestCache.h
RKRequestCache.m

Overview

Stores and retrieves cache entries for RestKit request objects.

Tasks

Initializating the Cache

Locating the Cache

Populating the Cache

Preparing Requests and Responses

Invalidating the Cache

Helpers

Properties

path

Returns the full pathname to the cache.

@property (nonatomic, readonly) NSString *path

Declared In

RKRequestCache.h

storagePolicy

The storage policy for the cache.

@property (nonatomic, assign) RKRequestCacheStoragePolicy storagePolicy

Declared In

RKRequestCache.h

Class Methods

rfc1123DateFormatter

The date formatter used to generate the cache date for the HTTP header.

+ (NSDateFormatter *)rfc1123DateFormatter

Declared In

RKRequestCache.h

Instance Methods

cacheDateForRequest:

Returns the date of the cached request.

- (NSDate *)cacheDateForRequest:(RKRequest *)request

Parameters

request

The request that needs a cache date returned.

Return Value

A date object for the cached request.

Declared In

RKRequestCache.h

etagForRequest:

Returns an ETag for a request if it is stored in the cached headers.

- (NSString *)etagForRequest:(RKRequest *)request

Parameters

request

The request that an ETag is to be determined for.

Return Value

A string of the ETag value stored for the specified request.

Declared In

RKRequestCache.h

hasResponseForRequest:

Determine if a response exists for a request.

- (BOOL)hasResponseForRequest:(RKRequest *)request

Parameters

request

An RKRequest object that is looking for cached content.

Return Value

A boolean value for if a response exists in the cache.

Declared In

RKRequestCache.h

headersForRequest:

Returns a dictionary of cached headers for a cached request.

- (NSDictionary *)headersForRequest:(RKRequest *)request

Parameters

request

The request to retrieve cached headers for.

Return Value

An NSDictionary of the cached headers that were stored for the specified request.

Declared In

RKRequestCache.h

initWithPath:storagePolicy:

Initializes the receiver with a cache at a given path and storage policy.

- (id)initWithPath:(NSString *)cachePath storagePolicy:(RKRequestCacheStoragePolicy)storagePolicy

Parameters

cachePath

The path to store cached data in.

storagePolicy

The storage policy to use for cached data.

Return Value

An initialized request cache object.

Declared In

RKRequestCache.h

invalidateAll

Invalidate all caches on disk.

- (void)invalidateAll

Declared In

RKRequestCache.h

invalidateRequest:

Invalidate the cache for a given request.

- (void)invalidateRequest:(RKRequest *)request

Parameters

request

The request that needs its cache invalidated.

Declared In

RKRequestCache.h

invalidateWithStoragePolicy:

Invalidate any caches that fall under the given storage policy.

- (void)invalidateWithStoragePolicy:(RKRequestCacheStoragePolicy)storagePolicy

Parameters

storagePolicy

The RKRequestCacheStorePolicy used to determine which caches need to be invalidated.

Declared In

RKRequestCache.h

pathForRequest:

Returns the cache path for the specified request.

- (NSString *)pathForRequest:(RKRequest *)request

Parameters

request

An RKRequest object to determine the cache path.

Return Value

A string of the cache path for the specified request.

Declared In

RKRequestCache.h

responseForRequest:

Returns the cached response for a given request.

- (RKResponse *)responseForRequest:(RKRequest *)request

Parameters

request

The request used to find the cached response.

Return Value

An RKResponse object that was cached for a given request.

Declared In

RKRequestCache.h

setCacheDate:forRequest:

Set the cache date for a request.

- (void)setCacheDate:(NSDate *)date forRequest:(RKRequest *)request

Parameters

date

The date the response for a request was cached.

request

The request to store the cache date for.

Declared In

RKRequestCache.h

storeResponse:forRequest:

Store a request’s response in the cache.

- (void)storeResponse:(RKResponse *)response forRequest:(RKRequest *)request

Parameters

response

The response to be stored in the cache.

request

The request that retrieved the response.

Declared In

RKRequestCache.h