Removes CacheItemPriority since this wasn't used, or was used in one place innapropriately.

This commit is contained in:
Shannon
2019-11-07 18:34:05 +11:00
parent 5ec78cd510
commit b4f3cc005d
10 changed files with 26 additions and 42 deletions

View File

@@ -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<T>().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<T> GetCacheItemsByKeySearch<T>(this IAppCache provider, string keyStartsWith)

View File

@@ -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
}
/// <inheritdoc />
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public object Get(string key, Func<object> 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);
}
/// <inheritdoc />
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public void Insert(string key, Func<object> 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);
}
/// <inheritdoc />

View File

@@ -1,5 +1,4 @@
using System;
using System.Web.Caching;
namespace Umbraco.Core.Cache
{
@@ -17,7 +16,6 @@ namespace Umbraco.Core.Cache
/// <param name="factory">A factory function that can create the item.</param>
/// <param name="timeout">An optional cache timeout.</param>
/// <param name="isSliding">An optional value indicating whether the cache timeout is sliding (default is false).</param>
/// <param name="priority">An optional cache priority (default is Normal).</param>
/// <param name="dependentFiles">Files the cache entry depends on.</param>
/// <returns>The item.</returns>
object Get(
@@ -25,7 +23,6 @@ namespace Umbraco.Core.Cache
Func<object> factory,
TimeSpan? timeout,
bool isSliding = false,
CacheItemPriority priority = CacheItemPriority.Normal,
string[] dependentFiles = null);
/// <summary>
@@ -35,14 +32,12 @@ namespace Umbraco.Core.Cache
/// <param name="factory">A factory function that can create the item.</param>
/// <param name="timeout">An optional cache timeout.</param>
/// <param name="isSliding">An optional value indicating whether the cache timeout is sliding (default is false).</param>
/// <param name="priority">An optional cache priority (default is Normal).</param>
/// <param name="dependentFiles">Files the cache entry depends on.</param>
void Insert(
string key,
Func<object> factory,
TimeSpan? timeout = null,
bool isSliding = false,
CacheItemPriority priority = CacheItemPriority.Normal,
string[] dependentFiles = null);
}
}

View File

@@ -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
}
/// <inheritdoc />
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null)
{
return factory();
}
/// <inheritdoc />
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null)
{ }
/// <inheritdoc />

View File

@@ -103,7 +103,7 @@ namespace Umbraco.Core.Cache
}
/// <inheritdoc />
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, string[] dependentFiles = null)
{
// see notes in HttpRuntimeAppCache
@@ -131,7 +131,7 @@ namespace Umbraco.Core.Cache
}
/// <inheritdoc />
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, string[] dependentFiles = null)
{
// NOTE - here also we must insert a Lazy<object> but we can evaluate it right now
// and make sure we don't store a null value.

View File

@@ -35,25 +35,25 @@ namespace Umbraco.Core.Cache
}
/// <inheritdoc />
public object Get(string key, Func<object> factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public object Get(string key, Func<object> 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);
}
/// <inheritdoc />
public void Insert(string key, Func<object> factory, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, string[] dependentFiles = null)
public void Insert(string key, Func<object> 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<object> factory, TimeSpan? timeout, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheDependency dependency = null)
private object GetImpl(string key, Func<object> 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<object> getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheItemPriority priority = CacheItemPriority.Normal, CacheDependency dependency = null)
private void InsertImpl(string cacheKey, Func<object> getCacheItem, TimeSpan? timeout = null, bool isSliding = false, CacheDependency dependency = null)
{
// NOTE - here also we must insert a Lazy<object> 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
{