Worked on the application cache, added request cache, changed some stuff over to be interfaces, added unit tests suite (need mroe) to test all caching providers.

Conflicts:
	src/Umbraco.Core/Cache/CacheProviderBase.cs
	src/Umbraco.Core/Cache/HttpRuntimeCacheProvider.cs
	src/Umbraco.Core/Cache/NullCacheProvider.cs
	src/Umbraco.Core/Cache/StaticCacheProvider.cs
This commit is contained in:
Shannon
2013-12-16 12:51:02 +11:00
parent 9105c08a4c
commit f11d4fbedd
21 changed files with 1012 additions and 344 deletions

View File

@@ -5,21 +5,21 @@ using System.Web.Caching;
namespace Umbraco.Core.Cache
{
internal class NullCacheProvider : RuntimeCacheProviderBase
internal class NullCacheProvider : IRuntimeCacheProvider
{
public override void ClearAllCache()
public virtual void ClearAllCache()
{
}
public override void ClearCacheItem(string key)
public virtual void ClearCacheItem(string key)
{
}
public override void ClearCacheObjectTypes(string typeName)
public virtual void ClearCacheObjectTypes(string typeName)
{
}
public override void ClearCacheObjectTypes<T>()
public virtual void ClearCacheObjectTypes<T>()
{
}
@@ -31,58 +31,58 @@ namespace Umbraco.Core.Cache
{
}
public override void ClearCacheByKeyExpression(string regexString)
public virtual void ClearCacheByKeyExpression(string regexString)
{
}
public override IEnumerable<T> GetCacheItemsByKeySearch<T>(string keyStartsWith)
public virtual IEnumerable<T> GetCacheItemsByKeySearch<T>(string keyStartsWith)
{
return Enumerable.Empty<T>();
}
public override T GetCacheItem<T>(string cacheKey)
public virtual T GetCacheItem<T>(string cacheKey)
{
return default(T);
}
public override T GetCacheItem<T>(string cacheKey, Func<T> getCacheItem)
public virtual T GetCacheItem<T>(string cacheKey, Func<T> getCacheItem)
{
return getCacheItem();
}
public override T GetCacheItem<T>(string cacheKey, TimeSpan? timeout, Func<T> getCacheItem)
public virtual T GetCacheItem<T>(string cacheKey, TimeSpan? timeout, Func<T> getCacheItem)
{
return getCacheItem();
}
public override T GetCacheItem<T>(string cacheKey, CacheItemRemovedCallback refreshAction, TimeSpan? timeout, Func<T> getCacheItem)
public virtual T GetCacheItem<T>(string cacheKey, CacheItemRemovedCallback refreshAction, TimeSpan? timeout, Func<T> getCacheItem)
{
return getCacheItem();
}
public override T GetCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan? timeout, Func<T> getCacheItem)
public virtual T GetCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan? timeout, Func<T> getCacheItem)
{
return getCacheItem();
}
public override T GetCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
public virtual T GetCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
{
return getCacheItem();
}
public override void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, Func<T> getCacheItem)
public virtual void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, Func<T> getCacheItem)
{
}
public override void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, TimeSpan? timeout, Func<T> getCacheItem)
public virtual void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, TimeSpan? timeout, Func<T> getCacheItem)
{
}
public override void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
public virtual void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
{
}
public override void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
public virtual void InsertCacheItem<T>(string cacheKey, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan? timeout, Func<T> getCacheItem)
{
}
}