Authored by Olivier Poitrey

Prevent double disk caching when `SDWebImageRefreshCached` option is used #326

@@ -129,7 +129,14 @@ @@ -129,7 +129,14 @@
129 } 129 }
130 else 130 else
131 { 131 {
132 - const BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly); 132 + BOOL cacheOnDisk = !(options & SDWebImageCacheMemoryOnly);
  133 +
  134 + if (options & SDWebImageRefreshCached)
  135 + {
  136 + // When SDWebImageRefreshCached option is enabled, the disk caching relies on NSURLCache one.
  137 + // We thus fork SDWebImage cache to be disabled so we don't duplicate the required storage space for nothing.
  138 + cacheOnDisk = NO;
  139 + }
133 140
134 if (downloadedImage && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)]) 141 if (downloadedImage && [self.delegate respondsToSelector:@selector(imageManager:transformDownloadedImage:withURL:)])
135 { 142 {