Revert that SDImageCacheQueryMemoryOnly because it's misunderstanding. Use `imag…
…eFromMemoryCacheForKey` instead
Showing
4 changed files
with
4 additions
and
9 deletions
@@ -27,17 +27,13 @@ typedef NS_ENUM(NSInteger, SDImageCacheType) { | @@ -27,17 +27,13 @@ typedef NS_ENUM(NSInteger, SDImageCacheType) { | ||
27 | 27 | ||
28 | typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { | 28 | typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { |
29 | /** | 29 | /** |
30 | - * By default, we will query disk cache if the memory cache missed. This mask can force to query memory cache only without disk data. | ||
31 | - */ | ||
32 | - SDImageCacheQueryMemoryOnly = 1 << 0, | ||
33 | - /** | ||
34 | * 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. | 30 | * 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. |
35 | */ | 31 | */ |
36 | - SDImageCacheQueryDataWhenInMemory = 1 << 1, | 32 | + SDImageCacheQueryDataWhenInMemory = 1 << 0, |
37 | /** | 33 | /** |
38 | * By default, we query the memory cache synchronously, disk cache asynchronously. This mask can force to query disk cache synchronously. | 34 | * By default, we query the memory cache synchronously, disk cache asynchronously. This mask can force to query disk cache synchronously. |
39 | */ | 35 | */ |
40 | - SDImageCacheQueryDiskSync = 1 << 2 | 36 | + SDImageCacheQueryDiskSync = 1 << 1 |
41 | }; | 37 | }; |
42 | 38 | ||
43 | typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); | 39 | typedef void(^SDCacheQueryCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); |
@@ -377,7 +377,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { | @@ -377,7 +377,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { | ||
377 | 377 | ||
378 | // First check the in-memory cache... | 378 | // First check the in-memory cache... |
379 | UIImage *image = [self imageFromMemoryCacheForKey:key]; | 379 | UIImage *image = [self imageFromMemoryCacheForKey:key]; |
380 | - BOOL shouldQueryMemoryOnly = (options & SDImageCacheQueryMemoryOnly) || (image && !(options & SDImageCacheQueryDataWhenInMemory)); | 380 | + BOOL shouldQueryMemoryOnly = (image && !(options & SDImageCacheQueryDataWhenInMemory)); |
381 | if (shouldQueryMemoryOnly) { | 381 | if (shouldQueryMemoryOnly) { |
382 | if (doneBlock) { | 382 | if (doneBlock) { |
383 | doneBlock(image, nil, SDImageCacheTypeMemory); | 383 | doneBlock(image, nil, SDImageCacheTypeMemory); |
@@ -25,7 +25,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { | @@ -25,7 +25,7 @@ typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { | ||
25 | SDWebImageLowPriority = 1 << 1, | 25 | SDWebImageLowPriority = 1 << 1, |
26 | 26 | ||
27 | /** | 27 | /** |
28 | - * This flag disables on-disk caching, including cache query and cache storing | 28 | + * This flag disables on-disk caching after the download finished, only cache in memory |
29 | */ | 29 | */ |
30 | SDWebImageCacheMemoryOnly = 1 << 2, | 30 | SDWebImageCacheMemoryOnly = 1 << 2, |
31 | 31 |
@@ -146,7 +146,6 @@ | @@ -146,7 +146,6 @@ | ||
146 | NSString *key = [self cacheKeyForURL:url]; | 146 | NSString *key = [self cacheKeyForURL:url]; |
147 | 147 | ||
148 | SDImageCacheOptions cacheOptions = 0; | 148 | SDImageCacheOptions cacheOptions = 0; |
149 | - if (options & SDWebImageCacheMemoryOnly) cacheOptions |= SDImageCacheQueryMemoryOnly; | ||
150 | if (options & SDWebImageQueryDataWhenInMemory) cacheOptions |= SDImageCacheQueryDataWhenInMemory; | 149 | if (options & SDWebImageQueryDataWhenInMemory) cacheOptions |= SDImageCacheQueryDataWhenInMemory; |
151 | if (options & SDWebImageQueryDiskSync) cacheOptions |= SDImageCacheQueryDiskSync; | 150 | if (options & SDWebImageQueryDiskSync) cacheOptions |= SDImageCacheQueryDiskSync; |
152 | 151 |
-
Please register or login to post a comment