RKRequestCache Class Reference
Inherits from | NSObject |
Declared in | RKRequestCache.h RKRequestCache.m |
Tasks
Initializating the Cache
-
– initWithPath:storagePolicy:
Initializes the receiver with a cache at a given path and storage policy.
Locating the Cache
-
path
Returns the full pathname to the cache.
property -
– pathForRequest:
Returns the cache path for the specified request.
-
– hasResponseForRequest:
Determine if a response exists for a request.
Populating the Cache
-
– storeResponse:forRequest:
Store a request’s response in the cache.
-
– setCacheDate:forRequest:
Set the cache date for a request.
Preparing Requests and Responses
-
– headersForRequest:
Returns a dictionary of cached headers for a cached request.
-
– etagForRequest:
Returns an ETag for a request if it is stored in the cached headers.
-
– cacheDateForRequest:
Returns the date of the cached request.
-
– responseForRequest:
Returns the cached response for a given request.
Invalidating the Cache
-
storagePolicy
The storage policy for the cache.
property -
– invalidateRequest:
Invalidate the cache for a given request.
-
– invalidateWithStoragePolicy:
Invalidate any caches that fall under the given storage policy.
-
– invalidateAll
Invalidate all caches on disk.
Helpers
-
+ rfc1123DateFormatter
The date formatter used to generate the cache date for the HTTP header.
Properties
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
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
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