diff --git a/Source/Details/ASPINRemoteImageDownloader.h b/Source/Details/ASPINRemoteImageDownloader.h index 179104901..c8879a1b4 100644 --- a/Source/Details/ASPINRemoteImageDownloader.h +++ b/Source/Details/ASPINRemoteImageDownloader.h @@ -58,6 +58,11 @@ NS_ASSUME_NONNULL_BEGIN */ - (PINRemoteImageManager *)sharedPINRemoteImageManager; +/** + * When downloading images ignore all caches. Defaults to NO. + */ +@property (nonatomic, assign) BOOL shouldIgnoreCache; + @end NS_ASSUME_NONNULL_END diff --git a/Source/Details/ASPINRemoteImageDownloader.m b/Source/Details/ASPINRemoteImageDownloader.m index 3fd3c86dc..c5edf4417 100644 --- a/Source/Details/ASPINRemoteImageDownloader.m +++ b/Source/Details/ASPINRemoteImageDownloader.m @@ -210,7 +210,13 @@ - (nullable id)downloadImageWithURL:(NSURL *)URL downloadProgress:(ASImageDownloaderProgress)downloadProgress completion:(ASImageDownloaderCompletion)completion; { - return [[self sharedPINRemoteImageManager] downloadImageWithURL:URL options:PINRemoteImageManagerDownloadOptionsSkipDecode progressDownload:^(int64_t completedBytes, int64_t totalBytes) { + PINRemoteImageManagerDownloadOptions options = PINRemoteImageManagerDownloadOptionsSkipDecode; + + if (_shouldIgnoreCache) { + options |= PINRemoteImageManagerDownloadOptionsIgnoreCache; + } + + return [[self sharedPINRemoteImageManager] downloadImageWithURL:URL options:options progressDownload:^(int64_t completedBytes, int64_t totalBytes) { if (downloadProgress == nil) { return; } /// If we're targeting the main queue and we're on the main thread, call immediately.