diff --git a/SDWebImage/SDDiskCache.m b/SDWebImage/SDDiskCache.m index 13e6f329..33354994 100644 --- a/SDWebImage/SDDiskCache.m +++ b/SDWebImage/SDDiskCache.m @@ -135,7 +135,7 @@ options:NSDirectoryEnumerationSkipsHiddenFiles errorHandler:NULL]; - NSDate *expirationDate = (self.config.maxCacheAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxCacheAge]; + NSDate *expirationDate = (self.config.maxDiskAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge]; NSMutableDictionary *> *cacheFiles = [NSMutableDictionary dictionary]; NSUInteger currentCacheSize = 0; @@ -172,7 +172,7 @@ // If our remaining disk cache exceeds a configured maximum size, perform a second // size-based cleanup pass. We delete the oldest files first. - NSUInteger maxCacheSize = self.config.maxCacheSize; + NSUInteger maxCacheSize = self.config.maxDiskSize; if (maxCacheSize > 0 && currentCacheSize > maxCacheSize) { // Target half of our maximum cache size for this cleanup pass. const NSUInteger desiredCacheSize = maxCacheSize / 2; diff --git a/SDWebImage/SDImageCache.h b/SDWebImage/SDImageCache.h index 558ead6a..4284cea8 100644 --- a/SDWebImage/SDImageCache.h +++ b/SDWebImage/SDImageCache.h @@ -323,12 +323,12 @@ typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { /** * Get the size used by the disk cache */ -- (NSUInteger)getSize; +- (NSUInteger)totalDiskSize; /** * Get the number of images in the disk cache */ -- (NSUInteger)getDiskCount; +- (NSUInteger)totalDiskCount; /** * Asynchronously calculate the disk cache's size. diff --git a/SDWebImage/SDImageCache.m b/SDWebImage/SDImageCache.m index e650a257..10506e82 100644 --- a/SDWebImage/SDImageCache.m +++ b/SDWebImage/SDImageCache.m @@ -564,7 +564,7 @@ #pragma mark - Cache Info -- (NSUInteger)getSize { +- (NSUInteger)totalDiskSize { __block NSUInteger size = 0; dispatch_sync(self.ioQueue, ^{ size = [self.diskCache totalSize]; @@ -572,7 +572,7 @@ return size; } -- (NSUInteger)getDiskCount { +- (NSUInteger)totalDiskCount { __block NSUInteger count = 0; dispatch_sync(self.ioQueue, ^{ count = [self.diskCache totalCount]; diff --git a/SDWebImage/SDImageCacheConfig.h b/SDWebImage/SDImageCacheConfig.h index 6d24ad93..97bf37e1 100644 --- a/SDWebImage/SDImageCacheConfig.h +++ b/SDWebImage/SDImageCacheConfig.h @@ -73,13 +73,13 @@ typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) { * Setting this to zero means that all cached files would be removed when do expiration check. * Defaults to 1 weak. */ -@property (assign, nonatomic) NSTimeInterval maxCacheAge; +@property (assign, nonatomic) NSTimeInterval maxDiskAge; /** * The maximum size of the disk cache, in bytes. * Defaults to 0. Which means there is no cache size limit. */ -@property (assign, nonatomic) NSUInteger maxCacheSize; +@property (assign, nonatomic) NSUInteger maxDiskSize; /** * The maximum "total cost" of the in-memory image cache. The cost function is the bytes size held in memory. diff --git a/SDWebImage/SDImageCacheConfig.m b/SDWebImage/SDImageCacheConfig.m index 085e2d79..831de835 100644 --- a/SDWebImage/SDImageCacheConfig.m +++ b/SDWebImage/SDImageCacheConfig.m @@ -31,8 +31,8 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week _shouldRemoveExpiredDataWhenEnterBackground = YES; _diskCacheReadingOptions = 0; _diskCacheWritingOptions = NSDataWritingAtomic; - _maxCacheAge = kDefaultCacheMaxCacheAge; - _maxCacheSize = 0; + _maxDiskAge = kDefaultCacheMaxCacheAge; + _maxDiskSize = 0; _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; _memoryCacheClass = [SDMemoryCache class]; _diskCacheClass = [SDDiskCache class]; @@ -48,8 +48,8 @@ static const NSInteger kDefaultCacheMaxCacheAge = 60 * 60 * 24 * 7; // 1 week config.shouldRemoveExpiredDataWhenEnterBackground = self.shouldRemoveExpiredDataWhenEnterBackground; config.diskCacheReadingOptions = self.diskCacheReadingOptions; config.diskCacheWritingOptions = self.diskCacheWritingOptions; - config.maxCacheAge = self.maxCacheAge; - config.maxCacheSize = self.maxCacheSize; + config.maxDiskAge = self.maxDiskAge; + config.maxDiskSize = self.maxDiskSize; config.maxMemoryCost = self.maxMemoryCost; config.maxMemoryCount = self.maxMemoryCount; config.diskCacheExpireType = self.diskCacheExpireType;