Installs runtime cache nuget into abstractions, moves more cache classes and preps AppCaches to not rely on system.web.
This commit is contained in:
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Cache
|
||||
/// instance, and ensuring that all inserts and returns are deep cloned copies of the cache item,
|
||||
/// when the item is deep-cloneable.
|
||||
/// </summary>
|
||||
internal class DeepCloneAppCache : IAppPolicyCache
|
||||
public class DeepCloneAppCache : IAppPolicyCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeepCloneAppCache"/> class.
|
||||
@@ -29,7 +29,7 @@ namespace Umbraco.Core.Cache
|
||||
/// <summary>
|
||||
/// Gets the inner cache.
|
||||
/// </summary>
|
||||
public IAppPolicyCache InnerCache { get; }
|
||||
private IAppPolicyCache InnerCache { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public object Get(string key)
|
||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.Cache
|
||||
/// <summary>
|
||||
/// Specifies how a repository cache policy should cache entities.
|
||||
/// </summary>
|
||||
internal class RepositoryCachePolicyOptions
|
||||
public class RepositoryCachePolicyOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Ctor - sets GetAllCacheValidateCount = true
|
||||
@@ -6,4 +6,8 @@
|
||||
<RootNamespace>Umbraco.Core</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Runtime.Caching" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Core.Cache
|
||||
{
|
||||
@@ -8,23 +7,6 @@ namespace Umbraco.Core.Cache
|
||||
/// </summary>
|
||||
public class AppCaches
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AppCaches"/> for use in a web application.
|
||||
/// </summary>
|
||||
public AppCaches()
|
||||
: this(HttpRuntime.Cache)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AppCaches"/> for use in a web application.
|
||||
/// </summary>
|
||||
public AppCaches(System.Web.Caching.Cache cache)
|
||||
: this(
|
||||
new WebCachingAppCache(cache),
|
||||
new HttpRequestAppCache(),
|
||||
new IsolatedCaches(t => new ObjectCacheAppCache()))
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AppCaches"/> with cache providers.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core.Cache
|
||||
/// <para>If options.GetAllCacheAllowZeroCount then a 'zero-count' array is cached when GetAll finds nothing.</para>
|
||||
/// <para>If options.GetAllCacheValidateCount then we check against the db when getting many entities.</para>
|
||||
/// </remarks>
|
||||
internal class DefaultRepositoryCachePolicy<TEntity, TId> : RepositoryCachePolicyBase<TEntity, TId>
|
||||
public class DefaultRepositoryCachePolicy<TEntity, TId> : RepositoryCachePolicyBase<TEntity, TId>
|
||||
where TEntity : class, IEntity
|
||||
{
|
||||
private static readonly TEntity[] EmptyEntities = new TEntity[0]; // const
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Cache
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the entity.</typeparam>
|
||||
/// <typeparam name="TId">The type of the identifier.</typeparam>
|
||||
internal abstract class RepositoryCachePolicyBase<TEntity, TId> : IRepositoryCachePolicy<TEntity, TId>
|
||||
public abstract class RepositoryCachePolicyBase<TEntity, TId> : IRepositoryCachePolicy<TEntity, TId>
|
||||
where TEntity : class, IEntity
|
||||
{
|
||||
private readonly IAppPolicyCache _globalCache;
|
||||
|
||||
@@ -124,16 +124,14 @@
|
||||
<DependentUpon>Constants.cs</DependentUpon>
|
||||
</Compile>
|
||||
-->
|
||||
<Compile Include="Cache\CacheRefresherBase.cs" />
|
||||
<Compile Include="Cache\DefaultRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\FastDictionaryAppCacheBase.cs" />
|
||||
<Compile Include="Cache\ObjectCacheAppCache.cs" />
|
||||
<Compile Include="Compose\AuditEventsComponent.cs" />
|
||||
<Compile Include="Cache\AppCaches.cs" />
|
||||
<Compile Include="Cache\CacheRefresherBase.cs" />
|
||||
<Compile Include="Cache\CacheRefresherCollection.cs" />
|
||||
<Compile Include="Cache\CacheRefresherCollectionBuilder.cs" />
|
||||
<Compile Include="Cache\CacheRefresherEventArgs.cs" />
|
||||
<Compile Include="Cache\DeepCloneAppCache.cs" />
|
||||
<Compile Include="Cache\DefaultRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\FastDictionaryAppCache.cs" />
|
||||
<Compile Include="Cache\FullDataSetRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\HttpRequestAppCache.cs" />
|
||||
@@ -141,7 +139,6 @@
|
||||
<Compile Include="Cache\JsonCacheRefresherBase.cs" />
|
||||
<Compile Include="Cache\PayloadCacheRefresherBase.cs" />
|
||||
<Compile Include="Cache\RepositoryCachePolicyBase.cs" />
|
||||
<Compile Include="Cache\RepositoryCachePolicyOptions.cs" />
|
||||
<Compile Include="Cache\SingleItemsOnlyRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\TypedCacheRefresherBase.cs" />
|
||||
<Compile Include="Compose\AuditEventsComposer.cs" />
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
_appCaches = new AppCaches();
|
||||
_appCaches = AppCaches.Disabled;
|
||||
CreateTestData();
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
var logger = new ConsoleLogger(new MessageTemplates());
|
||||
var profiler = new LogProfiler(logger);
|
||||
var profilingLogger = new ProfilingLogger(logger, profiler);
|
||||
var appCaches = new AppCaches(); // FIXME: has HttpRuntime stuff?
|
||||
var appCaches = AppCaches.Disabled;
|
||||
var databaseFactory = new UmbracoDatabaseFactory(logger, new Lazy<IMapperCollection>(() => factory.GetInstance<IMapperCollection>()));
|
||||
var typeLoader = new TypeLoader(appCaches.RuntimeCache, IOHelper.MapPath("~/App_Data/TEMP"), profilingLogger);
|
||||
var mainDom = new SimpleMainDom();
|
||||
|
||||
Reference in New Issue
Block a user