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
This commit is contained in:
Olivier Poitrey 2013-03-12 19:26:53 +01:00
parent 9a29af466b
commit 8cfd26f78b
2 changed files with 3 additions and 9 deletions

View File

@ -30,7 +30,7 @@
target:self
action:@selector(flushCache)];
_objects = [NSArray arrayWithObjects:
@"http://static2.dmcdn.net/static/video/451/838/44838154:jpeg_preview_small.jpg?20120509163826",
@"https://graph.facebook.com/olivier.poitrey/picture?height=200&width=200",
@"http://static2.dmcdn.net/static/video/656/177/44771656:jpeg_preview_small.jpg?20120509154705",
@"http://static2.dmcdn.net/static/video/629/228/44822926:jpeg_preview_small.jpg?20120509181018",
@"http://static2.dmcdn.net/static/video/116/367/44763611:jpeg_preview_small.jpg?20120509101749",
@ -371,8 +371,9 @@
}
cell.textLabel.text = [NSString stringWithFormat:@"Image #%d", indexPath.row];
cell.imageView.contentMode = UIViewContentModeScaleAspectFill;
[cell.imageView setImageWithURL:[NSURL URLWithString:[_objects objectAtIndex:indexPath.row]]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
return cell;
}

View File

@ -137,13 +137,6 @@
{
BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
if (options & SDWebImageRefreshCached)
{
// When SDWebImageRefreshCached option is enabled, the disk caching relies on NSURLCache one.
// We thus fork SDWebImage cache to be disabled so we don't duplicate the required storage space for nothing.
cacheOnDisk = NO;
}
if (options & SDWebImageRefreshCached && image && !downloadedImage)
{
// Image refresh hit the NSURLCache cache, do not call the completion block