Authored by Olivier Poitrey

Disable duplicate disk cache prevention with SDWebImageRefreshCached to handle 302 caching correctly

See https://github.com/rs/SDWebImage/pull/326#issuecomment-14791505 for more info
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 target:self 30 target:self
31 action:@selector(flushCache)]; 31 action:@selector(flushCache)];
32 _objects = [NSArray arrayWithObjects: 32 _objects = [NSArray arrayWithObjects:
33 - @"http://static2.dmcdn.net/static/video/451/838/44838154:jpeg_preview_small.jpg?20120509163826", 33 + @"https://graph.facebook.com/olivier.poitrey/picture?height=200&width=200",
34 @"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705", 34 @"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705",
35 @"http://static2.dmcdn.net/static/video/629/228/44822926:jpeg_preview_small.jpg?20120509181018", 35 @"http://static2.dmcdn.net/static/video/629/228/44822926:jpeg_preview_small.jpg?20120509181018",
36 @"http://static2.dmcdn.net/static/video/116/367/44763611:jpeg_preview_small.jpg?20120509101749", 36 @"http://static2.dmcdn.net/static/video/116/367/44763611:jpeg_preview_small.jpg?20120509101749",
@@ -371,8 +371,9 @@ @@ -371,8 +371,9 @@
371 } 371 }
372 372
373 cell.textLabel.text = [NSString stringWithFormat:@"Image #%d", indexPath.row]; 373 cell.textLabel.text = [NSString stringWithFormat:@"Image #%d", indexPath.row];
  374 + cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
374 [cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]] 375 [cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
375 - placeholderImage:[UIImage imageNamed:@"placeholder"]]; 376 + placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
376 return cell; 377 return cell;
377 } 378 }
378 379
@@ -137,13 +137,6 @@ @@ -137,13 +137,6 @@
137 { 137 {
138 BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly); 138 BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
139 139
140 - if (options & SDWebImageRefreshCached)  
141 - {  
142 - // When SDWebImageRefreshCached option is enabled, the disk caching relies on NSURLCache one.  
143 - // We thus fork SDWebImage cache to be disabled so we don't duplicate the required storage space for nothing.  
144 - cacheOnDisk = NO;  
145 - }  
146 -  
147 if (options & SDWebImageRefreshCached && image && !downloadedImage) 140 if (options & SDWebImageRefreshCached && image && !downloadedImage)
148 { 141 {
149 // Image refresh hit the NSURLCache cache, do not call the completion block 142 // Image refresh hit the NSURLCache cache, do not call the completion block