Skip to content

Commit

Permalink
Update SDImageCache.m
Browse files Browse the repository at this point in the history
adding logs
  • Loading branch information
camposbrunocampos authored Aug 20, 2024
1 parent 6d098ee commit 92ae0e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions SDWebImage/Core/SDImageCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ - (void)storeImage:(nullable UIImage *)image
if (completionBlock) {
completionBlock();
}
NSLog(@"@@ SDImageCache: will return, won't store image, no image no image data, no key %@", key);
return;
}
BOOL toMemory = cacheType == SDImageCacheTypeMemory || cacheType == SDImageCacheTypeAll;
Expand All @@ -252,12 +253,14 @@ - (void)storeImage:(nullable UIImage *)image
if (image && toMemory && self.config.shouldCacheImagesInMemory) {
NSUInteger cost = image.sd_memoryCost;
[self.memoryCache setObject:image forKey:key cost:cost];
NSLog(@"@@ SDImageCache: memory %@", key);
}

if (!toDisk) {
if (completionBlock) {
completionBlock();
}
NSLog(@"@@ SDImageCache: ended up in !toDisk %@", key);
return;
}
NSData *data = imageData;
Expand All @@ -281,6 +284,7 @@ - (void)storeImage:(nullable UIImage *)image
}
NSData *encodedData = [[SDImageCodersManager sharedManager] encodedDataWithImage:image format:format options:context[SDWebImageContextImageEncodeOptions]];
dispatch_async(self.ioQueue, ^{
NSLog(@"@@ SDImageCache: disk %@", key);
[self _storeImageDataToDisk:encodedData forKey:key];
[self _archivedDataWithImage:image forKey:key];
if (completionBlock) {
Expand All @@ -292,6 +296,7 @@ - (void)storeImage:(nullable UIImage *)image
});
} else {
dispatch_async(self.ioQueue, ^{
NSLog(@"@@ SDImageCache: disk2 - no data %@", key);
[self _storeImageDataToDisk:data forKey:key];
[self _archivedDataWithImage:image forKey:key];
if (completionBlock) {
Expand Down

0 comments on commit 92ae0e5

Please sign in to comment.