Merge pull request #2462 from zhongwuzw/fix-disk-size-check
Fix resource key invalid when clean cached disk file
This commit is contained in:
commit
3ff846aa85
|
@ -177,10 +177,10 @@
|
||||||
// Target half of our maximum cache size for this cleanup pass.
|
// Target half of our maximum cache size for this cleanup pass.
|
||||||
const NSUInteger desiredCacheSize = maxCacheSize / 2;
|
const NSUInteger desiredCacheSize = maxCacheSize / 2;
|
||||||
|
|
||||||
// Sort the remaining cache files by their last modification time (oldest first).
|
// Sort the remaining cache files by their last modification time or last access time (oldest first).
|
||||||
NSArray<NSURL *> *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent
|
NSArray<NSURL *> *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent
|
||||||
usingComparator:^NSComparisonResult(id obj1, id obj2) {
|
usingComparator:^NSComparisonResult(id obj1, id obj2) {
|
||||||
return [obj1[NSURLContentModificationDateKey] compare:obj2[NSURLContentModificationDateKey]];
|
return [obj1[cacheContentDateKey] compare:obj2[cacheContentDateKey]];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
// Delete files until we fall below our desired cache size.
|
// Delete files until we fall below our desired cache size.
|
||||||
|
|
Loading…
Reference in New Issue