I am using ASIDownloadCache to cache the download files, the code below is how I set the request and downloadcache. `request = [super initWithURL:url1]; [request setTimeOutSeconds:50];
ASIDownloadCache *cache = [[ASIDownloadCache alloc] init] ;
[cache setStoragePath:[path stringByAppendingPathComponent:@"resource"]];
[cache setShouldRespectCacheControlHeaders:NO];
self.myCache = cache;
[cache release];
[request setDownloadCache:self.myCache];
//[self setSecondsToCache:60*60*24*30];
[request setCachePolicy:ASIAskServerIfModifiedCachePolicy];
[request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
` My problem is that when the url's header has been modified, the ASIDownloadCache is still using the cached data. Why? Someone knows the answer?
The header of that url before changing is like the following:
HTTP/1.1 200 OK Server: Apache/2.2 Cache-Control: public Content-Type: text/html; charset=UTF-8 Date: Mon, 07 Nov 2011 08:26:15 GMT Expires: Mon, 07 Nov 2011 08:23:35 GMT Pragma: public Transfer-Encoding: chunked Etag: 1320654215 Connection: Keep-Alive Last-Modified: Mon, 07 Nov 2011 08:23:35 GMT
The header after modifying is like the following:
HTTP/1.1 200 OK Server: Apache/2.2 Cache-Control: public Content-Type: text/html; charset=UTF-8 Date: Mon, 07 Nov 2011 08:28:49 GMT Expires: Mon, 07 Nov 2011 08:28:32 GMT Pragma: public Transfer-Encoding: chunked Etag: 1320654512 Connection: Keep-Alive Last-Modified: Mon, 07 Nov 2011 08:28:32 GMT
Even the Last-Modified fields are not the same, it is still using the cached data.