From df1bb98ad69c098372b8346c417cf8443b793e4c Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 14 Jan 2018 21:12:33 +0800 Subject: [PATCH] Update the cache options name to make it more clear --- .../FLAnimatedImage/FLAnimatedImageView+WebCache.m | 4 ++-- SDWebImage/SDImageCache.h | 8 ++++---- SDWebImage/SDImageCache.m | 6 +++--- SDWebImage/SDWebImageManager.h | 10 +++++----- SDWebImage/SDWebImageManager.m | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m index b07b96b5..f52a40d4 100644 --- a/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m +++ b/SDWebImage/FLAnimatedImage/FLAnimatedImageView+WebCache.m @@ -46,8 +46,8 @@ options:(SDWebImageOptions)options progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { - options |= SDWebImageQueryDiskDataWhenInMemory; - options |= SDWebImageQueryDiskDataSync; + options |= SDWebImageQueryDataWhenInMemory; + options |= SDWebImageQueryDiskSync; dispatch_group_t group = dispatch_group_create(); __weak typeof(self)weakSelf = self; [self sd_internalSetImageWithURL:url diff --git a/SDWebImage/SDImageCache.h b/SDWebImage/SDImageCache.h index 88b4608a..13391740 100644 --- a/SDWebImage/SDImageCache.h +++ b/SDWebImage/SDImageCache.h @@ -27,13 +27,13 @@ typedef NS_ENUM(NSInteger, SDImageCacheType) { typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { /** - * By default, we do not query disk cache when the image is cached in memory. This mask can force query disk data at the same time. + * By default, we do not query disk data when the image is cached in memory. This mask can force to query disk data at the same time. */ - SDImageCacheQueryDiskDataWhenInMemory = 1 << 0, + SDImageCacheQueryDataWhenInMemory = 1 << 0, /** - * By default, we query the memory cache synchonized, disk cache asynchronized. This mask can force to query disk cache synchonized. + * By default, we query the memory cache synchronously, disk cache asynchronously. This mask can force to query disk cache synchronously. */ - SDImageCacheQueryDiskDataSync = 1 << 1 + SDImageCacheQueryDiskSync = 1 << 1 }; typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index 8f95e0cd..03cd2f47 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -356,7 +356,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { // First check the in-memory cache... UIImage *image = [self imageFromMemoryCacheForKey:key]; - if (image && !(options & SDImageCacheQueryDiskDataWhenInMemory)) { + if (image && !(options & SDImageCacheQueryDataWhenInMemory)) { if (doneBlock) { doneBlock(image, nil, SDImageCacheTypeMemory); } @@ -383,7 +383,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { } if (doneBlock) { - if (options & SDImageCacheQueryDiskDataSync) { + if (options & SDImageCacheQueryDiskSync) { doneBlock(diskImage, diskData, SDImageCacheTypeDisk); } else { dispatch_async(dispatch_get_main_queue(), ^{ @@ -394,7 +394,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { } }; - if (options & SDImageCacheQueryDiskDataSync) { + if (options & SDImageCacheQueryDiskSync) { queryDiskBlock(); } else { dispatch_async(self.ioQueue, queryDiskBlock); diff --git a/SDWebImage/SDWebImageManager.h b/SDWebImage/SDWebImageManager.h index 83789ffd..b5a810cd 100644 --- a/SDWebImage/SDWebImageManager.h +++ b/SDWebImage/SDWebImageManager.h @@ -97,16 +97,16 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { SDWebImageScaleDownLargeImages = 1 << 12, /** - * By default, we do not query disk cache when the image is cached in memory. This mask can force query disk data at the same time. - * This options is recommend to be used with `SDWebImageQueryDiskDataSync` to ensure the image is loaded in the same runloop. + * By default, we do not query disk data when the image is cached in memory. This mask can force to query disk data at the same time. + * This options is recommend to be used with `SDWebImageQueryDiskSync` to ensure the image is loaded in the same runloop. */ - SDWebImageQueryDiskDataWhenInMemory = 1 << 13, + SDWebImageQueryDataWhenInMemory = 1 << 13, /** - * By default, we query the memory cache synchonized, disk cache asynchronized. This mask can force to query disk cache synchonized to ensure that image is loaded in the same runloop. + * By default, we query the memory cache synchronously, disk cache asynchronously. This mask can force to query disk cache synchronously to ensure that image is loaded in the same runloop. * This can avoid flashing during cell reuse if you disable memory cache or in some other cases. */ - SDWebImageQueryDiskDataSync = 1 << 14 + SDWebImageQueryDiskSync = 1 << 14 }; typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL); diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index 95984d06..9696cf25 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -145,8 +145,8 @@ NSString *key = [self cacheKeyForURL:url]; SDImageCacheOptions cacheOptions = 0; - if (options & SDWebImageQueryDiskDataWhenInMemory) cacheOptions |= SDImageCacheQueryDiskDataWhenInMemory; - if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync; + if (options & SDWebImageQueryDataWhenInMemory) cacheOptions |= SDImageCacheQueryDataWhenInMemory; + if (options & SDWebImageQueryDiskSync) cacheOptions |= SDImageCacheQueryDiskSync; operation.cacheOperation = [self.imageCache queryCacheOperationForKey:key options:cacheOptions done:^(UIImage *cachedImage, NSData *cachedData, SDImageCacheType cacheType) { if (operation.isCancelled) {