Support to use the creation date and the change date to determine the disk cache expire date compare

This commit is contained in:
DreamPiggy 2019-12-26 14:53:53 +08:00
parent 69a62ff39d
commit f041dcabef
2 changed files with 17 additions and 5 deletions

View File

@ -146,11 +146,15 @@ static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDis
case SDImageCacheConfigExpireTypeAccessDate: case SDImageCacheConfigExpireTypeAccessDate:
cacheContentDateKey = NSURLContentAccessDateKey; cacheContentDateKey = NSURLContentAccessDateKey;
break; break;
case SDImageCacheConfigExpireTypeModificationDate: case SDImageCacheConfigExpireTypeModificationDate:
cacheContentDateKey = NSURLContentModificationDateKey; cacheContentDateKey = NSURLContentModificationDateKey;
break; break;
case SDImageCacheConfigExpireTypeCreationDate:
cacheContentDateKey = NSURLCreationDateKey;
break;
case SDImageCacheConfigExpireTypeChangeDate:
cacheContentDateKey = NSURLAttributeModificationDateKey;
break;
default: default:
break; break;
} }

View File

@ -12,13 +12,21 @@
/// Image Cache Expire Type /// Image Cache Expire Type
typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) { typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) {
/** /**
* When the image is accessed it will update this value * When the image cache is accessed it will update this value
*/ */
SDImageCacheConfigExpireTypeAccessDate, SDImageCacheConfigExpireTypeAccessDate,
/** /**
* The image was obtained from the disk cache (Default) * When the image cache is created or modified it will update this value (Default)
*/ */
SDImageCacheConfigExpireTypeModificationDate SDImageCacheConfigExpireTypeModificationDate,
/**
* When the image cache is created it will update this value
*/
SDImageCacheConfigExpireTypeCreationDate,
/**
* When the image cache is created, modified, renamed, file attribute updated (like permission, xattr) it will update this value
*/
SDImageCacheConfigExpireTypeChangeDate,
}; };
/** /**