Authored by Bogdan Poplauschi

Update for cache policy calculation: I think that if SDWebImageDownloaderIgnoreC…

…achedResponse is there, we need NSURLRequestReloadIgnoringLocalCacheData so we always reload.
@@ -166,7 +166,14 @@ @@ -166,7 +166,14 @@
166 } 166 }
167 167
168 // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise 168 // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise
169 - NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData; 169 + NSURLRequestCachePolicy cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
  170 + if (options & SDWebImageDownloaderUseNSURLCache) {
  171 + if (options & SDWebImageDownloaderIgnoreCachedResponse) {
  172 + cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
  173 + } else {
  174 + cachePolicy = NSURLRequestUseProtocolCachePolicy;
  175 + }
  176 + }
170 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url 177 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url
171 cachePolicy:cachePolicy 178 cachePolicy:cachePolicy
172 timeoutInterval:timeoutInterval]; 179 timeoutInterval:timeoutInterval];