Change image enhancer LastConfigurationChange to ConfigurationCacheKey

pull/702/head
Eric Reed 12 years ago
parent 8452e2f125
commit f4a199d275

@ -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,

@ -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();

@ -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.

Loading…
Cancel
Save