...
|
...
|
@@ -231,7 +231,6 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDWebImageCheckCacheCompletionBlock)completionBlock {
|
|
|
dispatch_async(_ioQueue, ^{
|
|
|
BOOL exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]];
|
...
|
...
|
@@ -255,7 +254,16 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
|
}
|
|
|
|
|
|
- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key {
|
|
|
UIImage *diskImage = [self diskImageForKey:key];
|
|
|
if (diskImage && self.config.shouldCacheImagesInMemory) {
|
|
|
NSUInteger cost = SDCacheCostForImage(diskImage);
|
|
|
[self.memCache setObject:diskImage forKey:key cost:cost];
|
|
|
}
|
|
|
|
|
|
return diskImage;
|
|
|
}
|
|
|
|
|
|
- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key {
|
|
|
// First check the in-memory cache...
|
|
|
UIImage *image = [self imageFromMemoryCacheForKey:key];
|
|
|
if (image) {
|
...
|
...
|
@@ -263,13 +271,8 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { |
|
|
}
|
|
|
|
|
|
// Second check the disk cache...
|
|
|
UIImage *diskImage = [self diskImageForKey:key];
|
|
|
if (diskImage && self.shouldCacheImagesInMemory) {
|
|
|
NSUInteger cost = SDCacheCostForImage(diskImage);
|
|
|
[self.memCache setObject:diskImage forKey:key cost:cost];
|
|
|
}
|
|
|
|
|
|
return diskImage;
|
|
|
image = [self imageFromDiskCacheForKey:key];
|
|
|
return image;
|
|
|
}
|
|
|
|
|
|
- (nullable NSData *)diskImageDataBySearchingAllPathsForKey:(nullable NSString *)key {
|
...
|
...
|
|