Permalink
Browse files

Prevent double disk caching when `SDWebImageRefreshCached` option is …

…used #326
  • Loading branch information...
1 parent 9b574e5 commit a3e3c61d463f09692632fe9cc592b2acc692cdd6 @rs committed Mar 12, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 SDWebImage/SDWebImageManager.m
@@ -129,7 +129,14 @@ - (NSString *)cacheKeyForURL:(NSURL *)url
}
else
{
- const BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
+ 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 (downloadedImage && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)])
{

0 comments on commit a3e3c61

Please sign in to comment.