It seems if I call:
setImageWithURLRequest:(NSURLRequest *)urlRequest
placeholderImage:(UIImage *)placeholderImage
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
That the resulting image will be put into AFNetworking's AFImageCache regardless of any cache policy set in HTTP response headers and will remain there and be fetched from there regardless of age, on subsequent requests to the same URL.
Is that accurate?
The only thing that forces it to ignore the cache, is to set NSURLRequestReloadIgnoringCacheData
or NSURLRequestReloadIgnoringLocalAndRemoteCacheData
in the request (by the way the resulting image will get re-cached by AFNetworking, so that's one way to force it to refresh it's cache).
Now, sure if the AFImageCache returns no hit, then AFNetworking will (I think), for exactly one request, use Apple's default NSURLCache which in theory does respect http cache headers. But that is just one request, because AFNetworking, then throws the result into its own permanent, non-http aware cache.
Let me know if I've got this wrong or missed anything.
According to Matt, the developer for AFNetworking, the solution to this is to override the behavior by setting the shared image cache to another class that conforms to the AFImageCache protocol. https://github.com/AFNetworking/AFNetworking/issues/2731
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With