From f4a199d27579a69c141ec311662a13b090779d82 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Thu, 23 May 2013 11:45:13 -0400 Subject: [PATCH] Change image enhancer LastConfigurationChange to ConfigurationCacheKey --- MediaBrowser.Api/Images/ImageService.cs | 3 +-- MediaBrowser.Controller/Drawing/ImageManager.cs | 2 +- MediaBrowser.Controller/Providers/IImageEnhancer.cs | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 51608a899..8db0609d9 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/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, diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs index 2d2bd5ae8..59b5eb8a3 100644 --- a/MediaBrowser.Controller/Drawing/ImageManager.cs +++ b/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(); diff --git a/MediaBrowser.Controller/Providers/IImageEnhancer.cs b/MediaBrowser.Controller/Providers/IImageEnhancer.cs index 24296b664..b4700aa83 100644 --- a/MediaBrowser.Controller/Providers/IImageEnhancer.cs +++ b/MediaBrowser.Controller/Providers/IImageEnhancer.cs @@ -24,12 +24,12 @@ namespace MediaBrowser.Controller.Providers MetadataProviderPriority Priority { get; } /// - /// 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 /// /// The item. /// Type of the image. - /// Date of last config change - DateTime LastConfigurationChange(BaseItem item, ImageType imageType); + /// Cache key relating to the current state of this item and configuration + string ConfigurationCacheKey(BaseItem item, ImageType imageType); /// /// Gets the size of the enhanced image.