Explorar o código

Merge pull request #2463 from zhongwuzw/fix-disk-size-check-for-master

Fix resource key invalid when clean cached disk file
DreamPiggy %!s(int64=7) %!d(string=hai) anos
pai
achega
9de56b013a
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      SDWebImage/SDImageCache.m

+ 2 - 2
SDWebImage/SDImageCache.m

@@ -707,10 +707,10 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
             // Target half of our maximum cache size for this cleanup pass.
             const NSUInteger desiredCacheSize = self.config.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
                                                                      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.