Statistics
| Branch: | Revision:

root / asi-http-request-with-pithos / Classes / ASIDownloadCache.h @ be116d22

History | View | Annotate | Download (1.7 kB)

1
//
2
//  ASIDownloadCache.h
3
//  Part of ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
4
//
5
//  Created by Ben Copsey on 01/05/2010.
6
//  Copyright 2010 All-Seeing Interactive. All rights reserved.
7
//
8

    
9
#import <Foundation/Foundation.h>
10
#import "ASICacheDelegate.h"
11

    
12
@interface ASIDownloadCache : NSObject <ASICacheDelegate> {
13
        
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 ASIUseDefaultCachePolicy
16
        // Defaults to ASIAskServerIfModifiedWhenStaleCachePolicy
17
        ASICachePolicy defaultCachePolicy;
18
        
19
        // The directory in which cached data will be stored
20
        // Defaults to a directory called 'ASIHTTPRequestCache' in the temporary directory
21
        NSString *storagePath;
22
        
23
        // Mediates access to the cache
24
        NSRecursiveLock *accessLock;
25
        
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;
28
}
29

    
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]];
33
+ (id)sharedCache;
34

    
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;
37

    
38
@property (assign, nonatomic) ASICachePolicy defaultCachePolicy;
39
@property (retain, nonatomic) NSString *storagePath;
40
@property (retain) NSRecursiveLock *accessLock;
41
@property (assign) BOOL shouldRespectCacheControlHeaders;
42
@end