Renaming the disk cache size/cache age method and property with disk keyword, clarify the meaning
This commit is contained in:
parent
d90ca19d1b
commit
b3a3a26a04
|
@ -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<NSURL *, NSDictionary<NSString *, id> *> *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;
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue