Web.PublishedCache - merge resolvers so caches can be related
This commit is contained in:
@@ -47,8 +47,8 @@ namespace Umbraco.Tests.PublishedContent
|
||||
typeof(YesNoPropertyEditorValueConverter)
|
||||
});
|
||||
|
||||
PublishedContentCacheResolver.Current = new PublishedContentCacheResolver(new PublishedContentCache());
|
||||
PublishedMediaCacheResolver.Current = new PublishedMediaCacheResolver(new PublishedMediaCache());
|
||||
PublishedCachesResolver.Current = new PublishedCachesResolver(new PublishedCaches(
|
||||
new PublishedContentCache(), new PublishedMediaCache()));
|
||||
|
||||
base.FreezeResolution();
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace Umbraco.Web.Cache
|
||||
// are creating a nasty dependency - but keep it like that for the time being while
|
||||
// SD is cleaning cache refreshers up.
|
||||
|
||||
var contentCache = PublishedContentCacheResolver.Current.ContentCache as PublishedContentCache;
|
||||
var contentCache = PublishedCachesResolver.Current.Caches.ContentCache as PublishedContentCache;
|
||||
if (contentCache != null)
|
||||
contentCache.RoutesCache.Clear();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Web.Cache
|
||||
// are creating a nasty dependency - but keep it like that for the time being while
|
||||
// SD is cleaning cache refreshers up.
|
||||
|
||||
var contentCache = PublishedContentCacheResolver.Current.ContentCache as PublishedContentCache;
|
||||
var contentCache = PublishedCachesResolver.Current.Caches.ContentCache as PublishedContentCache;
|
||||
if (contentCache != null)
|
||||
contentCache.RoutesCache.Clear();
|
||||
}
|
||||
|
||||
24
src/Umbraco.Web/PublishedCache/IPublishedCaches.cs
Normal file
24
src/Umbraco.Web/PublishedCache/IPublishedCaches.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides caches (content and media).
|
||||
/// </summary>
|
||||
/// <remarks>Groups caches that _may_ be related.</remarks>
|
||||
interface IPublishedCaches
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the content cache.
|
||||
/// </summary>
|
||||
IPublishedContentCache ContentCache { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media cache.
|
||||
/// </summary>
|
||||
IPublishedMediaCache MediaCache { get; }
|
||||
}
|
||||
}
|
||||
29
src/Umbraco.Web/PublishedCache/PublishedCaches.cs
Normal file
29
src/Umbraco.Web/PublishedCache/PublishedCaches.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides caches (content and media).
|
||||
/// </summary>
|
||||
/// <remarks>Default implementation for unrelated caches.</remarks>
|
||||
class PublishedCaches : IPublishedCaches
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedCaches"/> class with a content cache
|
||||
/// and a media cache.
|
||||
/// </summary>
|
||||
public PublishedCaches(IPublishedContentCache contentCache, IPublishedMediaCache mediaCache)
|
||||
{
|
||||
ContentCache = contentCache;
|
||||
MediaCache = mediaCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content cache.
|
||||
/// </summary>
|
||||
public IPublishedContentCache ContentCache { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media cache.
|
||||
/// </summary>
|
||||
public IPublishedMediaCache MediaCache { get; private set; }
|
||||
}
|
||||
}
|
||||
37
src/Umbraco.Web/PublishedCache/PublishedCachesResolver.cs
Normal file
37
src/Umbraco.Web/PublishedCache/PublishedCachesResolver.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the IPublishedCaches object.
|
||||
/// </summary>
|
||||
internal sealed class PublishedCachesResolver : SingleObjectResolverBase<PublishedCachesResolver, IPublishedCaches>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedCachesResolver"/> class with caches.
|
||||
/// </summary>
|
||||
/// <param name="caches">The caches.</param>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal PublishedCachesResolver(IPublishedCaches caches)
|
||||
: base(caches)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the caches.
|
||||
/// </summary>
|
||||
/// <param name="caches">The caches.</param>
|
||||
/// <remarks>For developers, at application startup.</remarks>
|
||||
public void SetCache(IPublishedCaches caches)
|
||||
{
|
||||
Value = caches;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the caches.
|
||||
/// </summary>
|
||||
public IPublishedCaches Caches
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the IPublishedContentCache object.
|
||||
/// </summary>
|
||||
internal sealed class PublishedContentCacheResolver : SingleObjectResolverBase<PublishedContentCacheResolver, IPublishedContentCache>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedContentCacheResolver"/> class with a content cache.
|
||||
/// </summary>
|
||||
/// <param name="publishedContentCache">The content cache.</param>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal PublishedContentCacheResolver(IPublishedContentCache publishedContentCache)
|
||||
: base(publishedContentCache)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the content cache.
|
||||
/// </summary>
|
||||
/// <param name="contentCache">The content cache.</param>
|
||||
/// <remarks>For developers, at application startup.</remarks>
|
||||
public void SetContentCache(IPublishedContentCache contentCache)
|
||||
{
|
||||
Value = contentCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the content cache.
|
||||
/// </summary>
|
||||
public IPublishedContentCache ContentCache
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the IPublicMediaCache object.
|
||||
/// </summary>
|
||||
internal sealed class PublishedMediaCacheResolver : SingleObjectResolverBase<PublishedMediaCacheResolver, IPublishedMediaCache>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PublishedMediaCacheResolver"/> class with a media cache.
|
||||
/// </summary>
|
||||
/// <param name="publishedMediaCache">The media cache.</param>
|
||||
/// <remarks>The resolver is created by the <c>WebBootManager</c> and thus the constructor remains internal.</remarks>
|
||||
internal PublishedMediaCacheResolver(IPublishedMediaCache publishedMediaCache)
|
||||
: base(publishedMediaCache)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Sets the media cache.
|
||||
/// </summary>
|
||||
/// <param name="publishedMediaCache">The media cache.</param>
|
||||
/// <remarks>For developers, at application startup.</remarks>
|
||||
public void SetContentCache(IPublishedMediaCache publishedMediaCache)
|
||||
{
|
||||
Value = publishedMediaCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media cache.
|
||||
/// </summary>
|
||||
public IPublishedMediaCache PublishedMediaCache
|
||||
{
|
||||
get { return Value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,6 +332,9 @@
|
||||
<Compile Include="PublishedCache\ContextualPublishedContentCache.cs" />
|
||||
<Compile Include="PublishedCache\ContextualPublishedCache.cs" />
|
||||
<Compile Include="PublishedCache\ContextualPublishedMediaCache.cs" />
|
||||
<Compile Include="PublishedCache\PublishedCachesResolver.cs" />
|
||||
<Compile Include="PublishedCache\IPublishedCaches.cs" />
|
||||
<Compile Include="PublishedCache\PublishedCaches.cs" />
|
||||
<Compile Include="PublishedCache\XmlPublishedCache\PublishedMediaCache.cs" />
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionary.cs" />
|
||||
<Compile Include="Dictionary\UmbracoCultureDictionaryFactory.cs" />
|
||||
@@ -369,8 +372,6 @@
|
||||
<Compile Include="PublishedCache\IPublishedCache.cs" />
|
||||
<Compile Include="PublishedCache\IPublishedContentCache.cs" />
|
||||
<Compile Include="PublishedCache\IPublishedMediaCache.cs" />
|
||||
<Compile Include="PublishedCache\PublishedContentCacheResolver.cs" />
|
||||
<Compile Include="PublishedCache\PublishedMediaCacheResolver.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="ExamineExtensions.cs" />
|
||||
<Compile Include="FormlessPage.cs">
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace Umbraco.Web
|
||||
var umbracoContext = new UmbracoContext(
|
||||
httpContext,
|
||||
applicationContext,
|
||||
PublishedContentCacheResolver.Current.ContentCache,
|
||||
PublishedMediaCacheResolver.Current.PublishedMediaCache);
|
||||
PublishedCachesResolver.Current.Caches.ContentCache,
|
||||
PublishedCachesResolver.Current.Caches.MediaCache);
|
||||
|
||||
// create the nice urls provider
|
||||
// there's one per request because there are some behavior parameters that can be changed
|
||||
|
||||
@@ -20,7 +20,6 @@ using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.PublishedCache.XmlPublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.WebApi;
|
||||
using umbraco.BusinessLogic;
|
||||
@@ -277,8 +276,9 @@ namespace Umbraco.Web
|
||||
PropertyEditorValueConvertersResolver.Current.RemoveType<TinyMcePropertyEditorValueConverter>();
|
||||
PropertyEditorValueConvertersResolver.Current.AddType<RteMacroRenderingPropertyEditorValueConverter>();
|
||||
|
||||
PublishedContentCacheResolver.Current = new PublishedContentCacheResolver(new PublishedContentCache());
|
||||
PublishedMediaCacheResolver.Current = new PublishedMediaCacheResolver(new PublishedMediaCache());
|
||||
PublishedCachesResolver.Current = new PublishedCachesResolver(new PublishedCaches(
|
||||
new PublishedCache.XmlPublishedCache.PublishedContentCache(),
|
||||
new PublishedCache.XmlPublishedCache.PublishedMediaCache()));
|
||||
|
||||
FilteredControllerFactoriesResolver.Current = new FilteredControllerFactoriesResolver(
|
||||
// add all known factories, devs can then modify this list on application
|
||||
@@ -313,7 +313,8 @@ namespace Umbraco.Web
|
||||
|
||||
SiteDomainHelperResolver.Current = new SiteDomainHelperResolver(new SiteDomainHelper());
|
||||
|
||||
PublishedContentCache.UnitTesting = _isForTesting;
|
||||
// ain't that a bit dirty?
|
||||
PublishedCache.XmlPublishedCache.PublishedContentCache.UnitTesting = _isForTesting;
|
||||
|
||||
ThumbnailProvidersResolver.Current = new ThumbnailProvidersResolver(
|
||||
PluginManager.Current.ResolveThumbnailProviders());
|
||||
|
||||
Reference in New Issue
Block a user