3 // Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
5 // Created by Ben Copsey on 01/05/2010.
6 // Copyright 2010 All-Seeing Interactive. All rights reserved.
9 #import <Foundation/Foundation.h>
10 #import "ASICacheDelegate.h"
12 @interface ASIDownloadCache : NSObject <ASICacheDelegate> {
14 // The default cache policy for this cache
15 // Requests that store data in the cache will use this cache policy if their cache policy is set to ASIDefaultCachePolicy
16 // Defaults to ASIReloadIfDifferentCachePolicy
17 ASICachePolicy defaultCachePolicy;
19 // The directory in which cached data will be stored
20 // Defaults to a directory called 'ASIHTTPRequestCache' in the temporary directory
21 NSString *storagePath;
23 // Mediates access to the cache
24 NSRecursiveLock *accessLock;
26 // When YES, the cache will look for cache-control / pragma: no-cache headers, and won't reuse store responses if it finds them
27 BOOL shouldRespectCacheControlHeaders;
30 // Returns a static instance of an ASIDownloadCache
31 // In most circumstances, it will make sense to use this as a global cache, rather than creating your own cache
32 // To make ASIHTTPRequests use it automatically, use [ASIHTTPRequest setDefaultCache:[ASIDownloadCache sharedCache]];
35 // A helper function that determines if the server has requested data should not be cached by looking at the request's response headers
36 + (BOOL)serverAllowsResponseCachingForRequest:(ASIHTTPRequest *)request;
38 // A date formatter that can be used to construct an RFC 1123 date
39 // The returned formatter is safe to use on the calling thread
40 // Do not use this formatter for parsing dates because the format can vary slightly - use ASIHTTPRequest's dateFromRFC1123String: class method instead
41 + (NSDateFormatter *)rfc1123DateFormatter;
43 @property (assign, nonatomic) ASICachePolicy defaultCachePolicy;
44 @property (retain, nonatomic) NSString *storagePath;
45 @property (retain) NSRecursiveLock *accessLock;
46 @property (assign) BOOL shouldRespectCacheControlHeaders;