diff --git a/src/Umbraco.Core/Cache/AppCacheExtensions.cs b/src/Umbraco.Abstractions/Cache/AppCacheExtensions.cs similarity index 88% rename from src/Umbraco.Core/Cache/AppCacheExtensions.cs rename to src/Umbraco.Abstractions/Cache/AppCacheExtensions.cs index a4edf6479e..cbefb5d5c0 100644 --- a/src/Umbraco.Core/Cache/AppCacheExtensions.cs +++ b/src/Umbraco.Abstractions/Cache/AppCacheExtensions.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Web.Caching; namespace Umbraco.Core.Cache { @@ -15,8 +14,6 @@ namespace Umbraco.Core.Cache Func getCacheItem, TimeSpan? timeout, bool isSliding = false, - CacheItemPriority priority = CacheItemPriority.Normal, - CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null) { var result = provider.Get(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles); @@ -28,8 +25,6 @@ namespace Umbraco.Core.Cache Func getCacheItem, TimeSpan? timeout = null, bool isSliding = false, - CacheItemPriority priority = CacheItemPriority.Normal, - CacheItemRemovedCallback removedCallback = null, string[] dependentFiles = null) { provider.Insert(cacheKey, () => getCacheItem(), timeout, isSliding, dependentFiles); diff --git a/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs b/src/Umbraco.Abstractions/Cache/AppPolicedCacheDictionary.cs similarity index 87% rename from src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs rename to src/Umbraco.Abstractions/Cache/AppPolicedCacheDictionary.cs index 5c60dededa..fa13ebf088 100644 --- a/src/Umbraco.Core/Cache/AppPolicedCacheDictionary.cs +++ b/src/Umbraco.Abstractions/Cache/AppPolicedCacheDictionary.cs @@ -17,24 +17,24 @@ namespace Umbraco.Core.Cache /// protected AppPolicedCacheDictionary(Func cacheFactory) { - CacheFactory = cacheFactory; + _cacheFactory = cacheFactory; } /// /// Gets the internal cache factory, for tests only! /// - internal readonly Func CacheFactory; + private readonly Func _cacheFactory; /// /// Gets or creates a cache. /// public IAppPolicyCache GetOrCreate(TKey key) - => _caches.GetOrAdd(key, k => CacheFactory(k)); + => _caches.GetOrAdd(key, k => _cacheFactory(k)); /// /// Tries to get a cache. /// - public Attempt Get(TKey key) + protected Attempt Get(TKey key) => _caches.TryGetValue(key, out var cache) ? Attempt.Succeed(cache) : Attempt.Fail(); /// @@ -56,7 +56,7 @@ namespace Umbraco.Core.Cache /// /// Clears a cache. /// - public void ClearCache(TKey key) + protected void ClearCache(TKey key) { if (_caches.TryGetValue(key, out var cache)) cache.Clear(); @@ -71,4 +71,4 @@ namespace Umbraco.Core.Cache cache.Clear(); } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Abstractions/Cache/IRepositoryCachePolicy.cs b/src/Umbraco.Abstractions/Cache/IRepositoryCachePolicy.cs index 020f4f7dd9..a31e715383 100644 --- a/src/Umbraco.Abstractions/Cache/IRepositoryCachePolicy.cs +++ b/src/Umbraco.Abstractions/Cache/IRepositoryCachePolicy.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Scoping; namespace Umbraco.Core.Cache { - internal interface IRepositoryCachePolicy + public interface IRepositoryCachePolicy where TEntity : class, IEntity { /// diff --git a/src/Umbraco.Core/Cache/IsolatedCaches.cs b/src/Umbraco.Abstractions/Cache/IsolatedCaches.cs similarity index 100% rename from src/Umbraco.Core/Cache/IsolatedCaches.cs rename to src/Umbraco.Abstractions/Cache/IsolatedCaches.cs diff --git a/src/Umbraco.Core/Cache/NoAppCache.cs b/src/Umbraco.Abstractions/Cache/NoAppCache.cs similarity index 100% rename from src/Umbraco.Core/Cache/NoAppCache.cs rename to src/Umbraco.Abstractions/Cache/NoAppCache.cs diff --git a/src/Umbraco.Core/Cache/NoCacheRepositoryCachePolicy.cs b/src/Umbraco.Abstractions/Cache/NoCacheRepositoryCachePolicy.cs similarity index 93% rename from src/Umbraco.Core/Cache/NoCacheRepositoryCachePolicy.cs rename to src/Umbraco.Abstractions/Cache/NoCacheRepositoryCachePolicy.cs index fecab66d84..20b57c49ff 100644 --- a/src/Umbraco.Core/Cache/NoCacheRepositoryCachePolicy.cs +++ b/src/Umbraco.Abstractions/Cache/NoCacheRepositoryCachePolicy.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Models.Entities; namespace Umbraco.Core.Cache { - internal class NoCacheRepositoryCachePolicy : IRepositoryCachePolicy + public class NoCacheRepositoryCachePolicy : IRepositoryCachePolicy where TEntity : class, IEntity { private NoCacheRepositoryCachePolicy() { } diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 34fd5349ee..644d30d38e 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -124,10 +124,8 @@ Constants.cs --> - - @@ -139,10 +137,7 @@ - - - diff --git a/src/Umbraco.Web/CacheHelperExtensions.cs b/src/Umbraco.Web/CacheHelperExtensions.cs index ae8df63415..615e6a3982 100644 --- a/src/Umbraco.Web/CacheHelperExtensions.cs +++ b/src/Umbraco.Web/CacheHelperExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Web; -using System.Web.Caching; using System.Web.Mvc; using System.Web.Mvc.Html; using Umbraco.Core.Cache; @@ -46,7 +45,6 @@ namespace Umbraco.Web return appCaches.RuntimeCache.GetCacheItem( PartialViewCacheKey + cacheKey, () => htmlHelper.Partial(partialViewName, model, viewData), - priority: CacheItemPriority.NotRemovable, //not removable, the same as macros (apparently issue #27610) timeout: new TimeSpan(0, 0, 0, cachedSeconds)); }