#20555: Don't cache routes with invalid duration

Work Item: 20555
This commit is contained in:
Sebastien Ros
2014-03-17 11:54:53 -07:00
parent ab72235c3f
commit 458d06a74e
2 changed files with 8 additions and 0 deletions

View File

@@ -47,6 +47,10 @@ namespace Orchard.Azure.Services.Caching.Output {
}
public void Set(string key, CacheItem cacheItem) {
if (cacheItem.ValidFor <= 0) {
return;
}
Logger.Debug("Set() invoked with key='{0}' in region '{1}'.", key, _regionAlphaNumeric);
_cache.Put(key, cacheItem, TimeSpan.FromSeconds(cacheItem.ValidFor), _regionAlphaNumeric);
}

View File

@@ -381,6 +381,10 @@ namespace Orchard.OutputCache.Filters {
// default duration of specific one ?
var cacheDuration = configuration != null && configuration.Duration.HasValue ? configuration.Duration.Value : _cacheDuration;
if (cacheDuration <= 0) {
return;
}
// include each of the content item ids as tags for the cache entry
var contentItemIds = _displayedContentItemHandler.GetDisplayed().Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray();