artifacts / AFCache

AFCache is an HTTP cache for iOS and OSX seeking towards full RFC2616 compliance
Apache License 2.0
361 stars 43 forks source link

Returning the Most Recent Cached Version THEN Downloading a New One #15

Closed m619 closed 9 years ago

m619 commented 12 years ago

I was wondering if AFCache can be used in the described way? It can help keep UIs way more responsive than simply waiting to retrieve the newest version of a file. If it can't be done with AFCache currently can you please describe which way would this be best implemented? Thank you. =]

artifacts commented 9 years ago

There is a new option called kAFCacheReturnFileBeforeRevalidation causes AFCache to behave this way.

Example

[self.cache cacheItemForURL:absoluteURL urlCredential:nil completionBlock:^(AFCacheableItem *item) {
---
    } failBlock:^(AFCacheableItem *item) {
...
    } progressBlock:^(AFCacheableItem *item) {
...        
    } requestConfiguration: requestConfiguration];