Fix typo in SDImageCache.m (#3705)

* Fix typo in SDImageCache.m

* Fix typo in SDImageCache.m
This commit is contained in:
zhaixian 2024-04-29 00:01:09 +08:00 committed by GitHub
parent ea2e3d5deb
commit e55cb041d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 7 deletions

View File

@ -435,12 +435,12 @@ static NSString * _defaultDiskCacheDirectory;
NSData *data = [self diskImageDataForKey:key];
UIImage *diskImage = [self diskImageForKey:key data:data options:options context:context];
BOOL shouldCacheToMomery = YES;
BOOL shouldCacheToMemory = YES;
if (context[SDWebImageContextStoreCacheType]) {
SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue];
shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);
shouldCacheToMemory = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);
}
if (shouldCacheToMomery) {
if (shouldCacheToMemory) {
// check if we need sync logic
[self _syncDiskToMemoryWithImage:diskImage forKey:key];
}
@ -683,20 +683,20 @@ static NSString * _defaultDiskCacheDirectory;
// the image is from in-memory cache, but need image data
diskImage = image;
} else if (diskData) {
BOOL shouldCacheToMomery = YES;
BOOL shouldCacheToMemory = YES;
if (context[SDWebImageContextStoreCacheType]) {
SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue];
shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);
shouldCacheToMemory = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory);
}
// Special case: If user query image in list for the same URL, to avoid decode and write **same** image object into disk cache multiple times, we query and check memory cache here again.
if (shouldCacheToMomery && self.config.shouldCacheImagesInMemory) {
if (shouldCacheToMemory && self.config.shouldCacheImagesInMemory) {
diskImage = [self.memoryCache objectForKey:key];
}
// decode image data only if in-memory cache missed
if (!diskImage) {
diskImage = [self diskImageForKey:key data:diskData options:options context:context];
// check if we need sync logic
if (shouldCacheToMomery) {
if (shouldCacheToMemory) {
[self _syncDiskToMemoryWithImage:diskImage forKey:key];
}
}