Fix wrong image cache type when disk and memory cache missed
This commit is contained in:
parent
e056218bbf
commit
5611863f6a
|
@ -535,12 +535,13 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSData *diskData = [self diskImageDataBySearchingAllPathsForKey:key];
|
NSData *diskData = [self diskImageDataBySearchingAllPathsForKey:key];
|
||||||
UIImage *diskImage;
|
UIImage *diskImage;
|
||||||
SDImageCacheType cacheType = SDImageCacheTypeDisk;
|
SDImageCacheType cacheType = SDImageCacheTypeNone;
|
||||||
if (image) {
|
if (image) {
|
||||||
// the image is from in-memory cache
|
// the image is from in-memory cache
|
||||||
diskImage = image;
|
diskImage = image;
|
||||||
cacheType = SDImageCacheTypeMemory;
|
cacheType = SDImageCacheTypeMemory;
|
||||||
} else if (diskData) {
|
} else if (diskData) {
|
||||||
|
cacheType = SDImageCacheTypeDisk;
|
||||||
// decode image data only if in-memory cache missed
|
// decode image data only if in-memory cache missed
|
||||||
diskImage = [self diskImageForKey:key data:diskData options:options];
|
diskImage = [self diskImageForKey:key data:diskData options:options];
|
||||||
if (diskImage && self.config.shouldCacheImagesInMemory) {
|
if (diskImage && self.config.shouldCacheImagesInMemory) {
|
||||||
|
|
Loading…
Reference in New Issue