瀏覽代碼

Change image enhancer LastConfigurationChange to ConfigurationCacheKey

Eric Reed 12 年之前
父節點
當前提交
f4a199d275

+ 1 - 2
MediaBrowser.Api/Images/ImageService.cs

@@ -668,7 +668,6 @@ namespace MediaBrowser.Api.Images
             }
 
             var contentType = MimeTypes.GetMimeType(imagePath);
-            var dateLastModified = (supportedImageEnhancers.Select(e => e.LastConfigurationChange(item, request.Type)).Concat(new[] { originalFileImageDateModified })).Max();
 
             var cacheGuid = kernel.ImageManager.GetImageCacheTag(imagePath, originalFileImageDateModified, supportedImageEnhancers, item, request.Type);
 
@@ -679,7 +678,7 @@ namespace MediaBrowser.Api.Images
                 cacheDuration = TimeSpan.FromDays(365);
             }
 
-            return ToCachedResult(cacheGuid, dateLastModified, cacheDuration, () => new ImageWriter
+            return ToCachedResult(cacheGuid, originalFileImageDateModified, cacheDuration, () => new ImageWriter
             {
                 Item = item,
                 Request = request,

+ 1 - 1
MediaBrowser.Controller/Drawing/ImageManager.cs

@@ -642,7 +642,7 @@ namespace MediaBrowser.Controller.Drawing
             }
 
             // Cache name is created with supported enhancers combined with the last config change so we pick up new config changes
-            var cacheKeys = imageEnhancers.Select(i => i.GetType().Name + i.LastConfigurationChange(item, imageType).Ticks).ToList();
+            var cacheKeys = imageEnhancers.Select(i => i.ConfigurationCacheKey(item, imageType)).ToList();
             cacheKeys.Add(originalImagePath + dateModified.Ticks);
 
             return string.Join("|", cacheKeys.ToArray()).GetMD5();

+ 3 - 3
MediaBrowser.Controller/Providers/IImageEnhancer.cs

@@ -24,12 +24,12 @@ namespace MediaBrowser.Controller.Providers
         MetadataProviderPriority Priority { get; }
 
         /// <summary>
-        /// Return the date of the last configuration change affecting the provided baseitem and image type
+        /// Return a key incorporating all configuration information related to this item
         /// </summary>
         /// <param name="item">The item.</param>
         /// <param name="imageType">Type of the image.</param>
-        /// <returns>Date of last config change</returns>
-        DateTime LastConfigurationChange(BaseItem item, ImageType imageType);
+        /// <returns>Cache key relating to the current state of this item and configuration</returns>
+        string ConfigurationCacheKey(BaseItem item, ImageType imageType);
 
         /// <summary>
         /// Gets the size of the enhanced image.