diff --git a/src/Umbraco.Core/Cache/AppCacheExtensions.cs b/src/Umbraco.Core/Cache/AppCacheExtensions.cs index 286b6bd54d..a4edf6479e 100644 --- a/src/Umbraco.Core/Cache/AppCacheExtensions.cs +++ b/src/Umbraco.Core/Cache/AppCacheExtensions.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Cache CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null) { - var result = provider.Get(cacheKey, () => getCacheItem(), timeout, isSliding, priority, dependentFiles); + var result = provider.Get(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles); return result == null ? default(T) : result.TryConvertTo().Result; } @@ -32,7 +32,7 @@ namespace Umbraco.Core.Cache CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null) { - provider.Insert(cacheKey, () => getCacheItem(), timeout, isSliding, priority, dependentFiles); + provider.Insert(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles); } public static IEnumerable GetCacheItemsByKeySearch(this IAppCache provider, string keyStartsWith) diff --git a/src/Umbraco.Core/Cache/DeepCloneAppCache.cs b/src/Umbraco.Core/Cache/DeepCloneAppCache.cs index a934f32dbf..29d147ba57 100644 --- a/src/Umbraco.Core/Cache/DeepCloneAppCache.cs +++ b/src/Umbraco.Core/Cache/DeepCloneAppCache.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Web.Caching; using Umbraco.Core.Models; using Umbraco.Core.Models.Entities; @@ -67,7 +66,7 @@ namespace Umbraco.Core.Cache } /// - public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null) { var cached = InnerCache.Get(key, () => { @@ -77,14 +76,14 @@ namespace Umbraco.Core.Cache return value == null ? null : CheckCloneableAndTracksChanges(value); // clone / reset to go into the cache - }, timeout, isSliding, priority, dependentFiles); + }, timeout, isSliding, dependentFiles); // clone / reset to go into the cache return CheckCloneableAndTracksChanges(cached); } /// - public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null) { InnerCache.Insert(key, () => { @@ -92,7 +91,7 @@ namespace Umbraco.Core.Cache var value = result.Value; // force evaluation now - this may throw if cacheItem throws, and then nothing goes into cache // do not store null values (backward compat), clone / reset to go into the cache return value == null ? null : CheckCloneableAndTracksChanges(value); - }, timeout, isSliding, priority, dependentFiles); + }, timeout, isSliding, dependentFiles); } /// diff --git a/src/Umbraco.Core/Cache/IAppPolicyCache.cs b/src/Umbraco.Core/Cache/IAppPolicyCache.cs index 6b09037fa1..9746e80804 100644 --- a/src/Umbraco.Core/Cache/IAppPolicyCache.cs +++ b/src/Umbraco.Core/Cache/IAppPolicyCache.cs @@ -1,5 +1,4 @@ using System; -using System.Web.Caching; namespace Umbraco.Core.Cache { @@ -17,7 +16,6 @@ namespace Umbraco.Core.Cache /// A factory function that can create the item. /// An optional cache timeout. /// An optional value indicating whether the cache timeout is sliding (default is false). - /// An optional cache priority (default is Normal). /// Files the cache entry depends on. /// The item. object Get( @@ -25,7 +23,6 @@ namespace Umbraco.Core.Cache Func factory, TimeSpan? timeout, bool isSliding = false, - CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null); /// @@ -35,14 +32,12 @@ namespace Umbraco.Core.Cache /// A factory function that can create the item. /// An optional cache timeout. /// An optional value indicating whether the cache timeout is sliding (default is false). - /// An optional cache priority (default is Normal). /// Files the cache entry depends on. void Insert( string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, - CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null); } } diff --git a/src/Umbraco.Core/Cache/NoAppCache.cs b/src/Umbraco.Core/Cache/NoAppCache.cs index 336948bc83..24c51c935a 100644 --- a/src/Umbraco.Core/Cache/NoAppCache.cs +++ b/src/Umbraco.Core/Cache/NoAppCache.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Web.Caching; namespace Umbraco.Core.Cache { @@ -42,13 +41,13 @@ namespace Umbraco.Core.Cache } /// - public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null) { return factory(); } /// - public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null) { } /// diff --git a/src/Umbraco.Core/Cache/ObjectCacheAppCache.cs b/src/Umbraco.Core/Cache/ObjectCacheAppCache.cs index 2701313423..016c5c3083 100644 --- a/src/Umbraco.Core/Cache/ObjectCacheAppCache.cs +++ b/src/Umbraco.Core/Cache/ObjectCacheAppCache.cs @@ -103,7 +103,7 @@ namespace Umbraco.Core.Cache } /// - public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null) { // see notes in HttpRuntimeAppCache @@ -131,7 +131,7 @@ namespace Umbraco.Core.Cache } /// - public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null) { // NOTE - here also we must insert a Lazy but we can evaluate it right now // and make sure we don't store a null value. diff --git a/src/Umbraco.Core/Cache/WebCachingAppCache.cs b/src/Umbraco.Core/Cache/WebCachingAppCache.cs index da3b5def1e..8711a025e0 100644 --- a/src/Umbraco.Core/Cache/WebCachingAppCache.cs +++ b/src/Umbraco.Core/Cache/WebCachingAppCache.cs @@ -35,25 +35,25 @@ namespace Umbraco.Core.Cache } /// - public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public object Get(string key, Func factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null) { CacheDependency dependency = null; if (dependentFiles != null && dependentFiles.Any()) { dependency = new CacheDependency(dependentFiles); } - return GetImpl(key, factory, timeout, isSliding, priority, dependency); + return GetImpl(key, factory, timeout, isSliding, dependency); } /// - public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null) + public void Insert(string key, Func factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null) { CacheDependency dependency = null; if (dependentFiles != null && dependentFiles.Any()) { dependency = new CacheDependency(dependentFiles); } - InsertImpl(key, factory, timeout, isSliding, priority, dependency); + InsertImpl(key, factory, timeout, isSliding, dependency); } #region Dictionary @@ -103,7 +103,7 @@ namespace Umbraco.Core.Cache #endregion - private object GetImpl(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheDependency dependency = null) + private object GetImpl(string key, Func factory, TimeSpan? timeout, bool isSliding = false, CacheDependency dependency = null) { key = GetCacheKey(key); @@ -164,7 +164,7 @@ namespace Umbraco.Core.Cache lck.UpgradeToWriteLock(); //NOTE: 'Insert' on System.Web.Caching.Cache actually does an add or update! - _cache.Insert(key, result, dependency, absolute, sliding, priority, null); + _cache.Insert(key, result, dependency, absolute, sliding, CacheItemPriority.Normal, null); } } @@ -180,7 +180,7 @@ namespace Umbraco.Core.Cache return value; } - private void InsertImpl(string cacheKey, Func getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheDependency dependency = null) + private void InsertImpl(string cacheKey, Func getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheDependency dependency = null) { // NOTE - here also we must insert a Lazy but we can evaluate it right now // and make sure we don't store a null value. @@ -198,7 +198,7 @@ namespace Umbraco.Core.Cache { _locker.EnterWriteLock(); //NOTE: 'Insert' on System.Web.Caching.Cache actually does an add or update! - _cache.Insert(cacheKey, result, dependency, absolute, sliding, priority, null); + _cache.Insert(cacheKey, result, dependency, absolute, sliding, CacheItemPriority.Normal, null); } finally { diff --git a/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs b/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs index ca91c63621..5f9e94a4fc 100644 --- a/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs +++ b/src/Umbraco.Tests/Cache/DefaultCachePolicyTests.cs @@ -29,8 +29,7 @@ namespace Umbraco.Tests.Cache { var isCached = false; var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback(() => { isCached = true; @@ -59,8 +58,7 @@ namespace Umbraco.Tests.Cache { var cached = new List(); var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback((string cacheKey, Func o, TimeSpan? t, bool b, CacheItemPriority cip, CacheItemRemovedCallback circ, string[] s) => { cached.Add(cacheKey); diff --git a/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs b/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs index f48974657c..e0ffb7e4cd 100644 --- a/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs +++ b/src/Umbraco.Tests/Cache/FullDataSetCachePolicyTests.cs @@ -38,8 +38,7 @@ namespace Umbraco.Tests.Cache var isCached = false; var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback(() => { isCached = true; @@ -79,8 +78,7 @@ namespace Umbraco.Tests.Cache IList list = null; var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback((string cacheKey, Func o, TimeSpan? t, bool b, CacheItemPriority cip, CacheItemRemovedCallback circ, string[] s) => { cached.Add(cacheKey); @@ -122,8 +120,7 @@ namespace Umbraco.Tests.Cache IList list = null; var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback((string cacheKey, Func o, TimeSpan? t, bool b, CacheItemPriority cip, CacheItemRemovedCallback circ, string[] s) => { cached.Add(cacheKey); diff --git a/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs b/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs index ea68873525..f34f4082bd 100644 --- a/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs +++ b/src/Umbraco.Tests/Cache/SingleItemsOnlyCachePolicyTests.cs @@ -29,8 +29,7 @@ namespace Umbraco.Tests.Cache { var cached = new List(); var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback((string cacheKey, Func o, TimeSpan? t, bool b, CacheItemPriority cip, CacheItemRemovedCallback circ, string[] s) => { cached.Add(cacheKey); @@ -53,8 +52,7 @@ namespace Umbraco.Tests.Cache { var isCached = false; var cache = new Mock(); - cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), - It.IsAny(), It.IsAny())) + cache.Setup(x => x.Insert(It.IsAny(), It.IsAny>(), It.IsAny(), It.IsAny(), It.IsAny())) .Callback(() => { isCached = true; diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index 3368def084..038a4d2431 100755 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using System.Web.Caching; using Umbraco.Core; using Umbraco.Core.Cache; using Umbraco.Core.Configuration.UmbracoSettings; @@ -139,8 +138,7 @@ namespace Umbraco.Web.Macros cache.Insert( CacheKeys.MacroContentCacheKey + model.CacheIdentifier, () => macroContent, - new TimeSpan(0, 0, model.CacheDuration), - priority: CacheItemPriority.NotRemovable + new TimeSpan(0, 0, model.CacheDuration) ); _plogger.Debug("Macro content saved to cache '{MacroCacheId}'", model.CacheIdentifier);