More renaming of caches
This commit is contained in:
@@ -21,7 +21,7 @@ namespace Umbraco.Core.Cache
|
||||
public AppCaches(System.Web.Caching.Cache cache)
|
||||
: this(
|
||||
new WebCachingAppCache(cache),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
new HttpRequestAppCache(),
|
||||
new IsolatedCaches(t => new ObjectCacheAppCache()))
|
||||
{ }
|
||||
@@ -31,12 +31,12 @@ namespace Umbraco.Core.Cache
|
||||
/// </summary>
|
||||
public AppCaches(
|
||||
IAppPolicyCache runtimeCache,
|
||||
IAppCache staticCacheProvider,
|
||||
IAppCache staticCache,
|
||||
IAppCache requestCache,
|
||||
IsolatedCaches isolatedCaches)
|
||||
{
|
||||
RuntimeCache = runtimeCache ?? throw new ArgumentNullException(nameof(runtimeCache));
|
||||
StaticCache = staticCacheProvider ?? throw new ArgumentNullException(nameof(staticCacheProvider));
|
||||
StaticCache = staticCache ?? throw new ArgumentNullException(nameof(staticCache));
|
||||
RequestCache = requestCache ?? throw new ArgumentNullException(nameof(requestCache));
|
||||
IsolatedCaches = isolatedCaches ?? throw new ArgumentNullException(nameof(isolatedCaches));
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ namespace Umbraco.Core.Cache
|
||||
/// <summary>
|
||||
/// Implements <see cref="IAppCache"/> on top of a concurrent dictionary.
|
||||
/// </summary>
|
||||
public class DictionaryCacheProvider : IAppCache
|
||||
public class DictionaryAppCache : IAppCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the internal items dictionary, for tests only!
|
||||
+1
-1
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Cache
|
||||
/// <summary>
|
||||
/// Implements a fast <see cref="IAppCache"/> on top of a concurrent dictionary.
|
||||
/// </summary>
|
||||
internal class FastDictionaryCacheProvider : IAppCache
|
||||
internal class FastDictionaryAppCache : IAppCache
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the internal items dictionary, for tests only!
|
||||
@@ -332,7 +332,7 @@ namespace Umbraco.Core.Runtime
|
||||
|
||||
return new AppCaches(
|
||||
new DeepCloneAppCache(new ObjectCacheAppCache()),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
NoAppCache.Instance,
|
||||
new IsolatedCaches(type => new DeepCloneAppCache(new ObjectCacheAppCache())));
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<Compile Include="Cache\CacheRefresherEventArgs.cs" />
|
||||
<Compile Include="Cache\DeepCloneAppCache.cs" />
|
||||
<Compile Include="Cache\DefaultRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\FastDictionaryCacheProvider.cs" />
|
||||
<Compile Include="Cache\FastDictionaryAppCache.cs" />
|
||||
<Compile Include="Cache\FastDictionaryAppCacheBase.cs" />
|
||||
<Compile Include="Cache\FullDataSetRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\HttpRequestAppCache.cs" />
|
||||
@@ -141,7 +141,7 @@
|
||||
<Compile Include="Cache\RepositoryCachePolicyBase.cs" />
|
||||
<Compile Include="Cache\RepositoryCachePolicyOptions.cs" />
|
||||
<Compile Include="Cache\SingleItemsOnlyRepositoryCachePolicy.cs" />
|
||||
<Compile Include="Cache\DictionaryCacheProvider.cs" />
|
||||
<Compile Include="Cache\DictionaryAppCache.cs" />
|
||||
<Compile Include="Cache\TypedCacheRefresherBase.cs" />
|
||||
<Compile Include="CodeAnnotations\FriendlyNameAttribute.cs" />
|
||||
<Compile Include="CodeAnnotations\UmbracoObjectTypeAttribute.cs" />
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Umbraco.Tests.Cache
|
||||
[Test]
|
||||
public void Throws_On_Reentry()
|
||||
{
|
||||
// don't run for StaticCacheProvider - not making sense
|
||||
if (GetType() == typeof (StaticAppCacheTests))
|
||||
Assert.Ignore("Do not run for StaticCacheProvider.");
|
||||
// don't run for DictionaryAppCache - not making sense
|
||||
if (GetType() == typeof (DictionaryAppCacheTests))
|
||||
Assert.Ignore("Do not run for DictionaryAppCache.");
|
||||
|
||||
Exception exception = null;
|
||||
var result = AppCache.Get("blah", () =>
|
||||
|
||||
@@ -7,19 +7,19 @@ namespace Umbraco.Tests.Cache
|
||||
[TestFixture]
|
||||
public class HttpRequestAppCacheTests : AppCacheTests
|
||||
{
|
||||
private HttpRequestAppCache _provider;
|
||||
private HttpRequestAppCache _appCache;
|
||||
private FakeHttpContextFactory _ctx;
|
||||
|
||||
public override void Setup()
|
||||
{
|
||||
base.Setup();
|
||||
_ctx = new FakeHttpContextFactory("http://localhost/test");
|
||||
_provider = new HttpRequestAppCache(_ctx.HttpContext);
|
||||
_appCache = new HttpRequestAppCache(_ctx.HttpContext);
|
||||
}
|
||||
|
||||
internal override IAppCache AppCache
|
||||
{
|
||||
get { return _provider; }
|
||||
get { return _appCache; }
|
||||
}
|
||||
|
||||
protected override int GetTotalItemCount
|
||||
@@ -29,24 +29,24 @@ namespace Umbraco.Tests.Cache
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
public class StaticAppCacheTests : AppCacheTests
|
||||
public class DictionaryAppCacheTests : AppCacheTests
|
||||
{
|
||||
private DictionaryCacheProvider _provider;
|
||||
private DictionaryAppCache _appCache;
|
||||
|
||||
public override void Setup()
|
||||
{
|
||||
base.Setup();
|
||||
_provider = new DictionaryCacheProvider();
|
||||
_appCache = new DictionaryAppCache();
|
||||
}
|
||||
|
||||
internal override IAppCache AppCache
|
||||
{
|
||||
get { return _provider; }
|
||||
get { return _appCache; }
|
||||
}
|
||||
|
||||
protected override int GetTotalItemCount
|
||||
{
|
||||
get { return _provider.Items.Count; }
|
||||
get { return _appCache.Items.Count; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
_xml = new XmlDocument();
|
||||
_xml.LoadXml(GetXml());
|
||||
var xmlStore = new XmlStore(() => _xml, null, null, null);
|
||||
var appCache = new DictionaryCacheProvider();
|
||||
var appCache = new DictionaryAppCache();
|
||||
var domainCache = new DomainCache(ServiceContext.DomainService, DefaultCultureAccessor);
|
||||
var publishedShapshot = new Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedSnapshot(
|
||||
new PublishedContentCache(xmlStore, domainCache, appCache, globalSettings, new SiteDomainHelper(), ContentTypesCache, null, null),
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
var mChild2 = MakeNewMedia("Child2", mType, user, mRoot2.Id);
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument) null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var roots = cache.GetAtRoot();
|
||||
Assert.AreEqual(2, roots.Count());
|
||||
Assert.IsTrue(roots.Select(x => x.Id).ContainsAll(new[] {mRoot1.Id, mRoot2.Id}));
|
||||
@@ -93,7 +93,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
|
||||
//var publishedMedia = PublishedMediaTests.GetNode(mRoot.Id, GetUmbracoContext("/test", 1234));
|
||||
var umbracoContext = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), Current.Services.MediaService, Current.Services.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), Current.Services.MediaService, Current.Services.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var publishedMedia = cache.GetById(mRoot.Id);
|
||||
Assert.IsNotNull(publishedMedia);
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
|
||||
var result = new SearchResult("1234", 1, () => fields.ToDictionary(x => x.Key, x => new List<string> { x.Value }));
|
||||
|
||||
var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var store = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var doc = store.CreateFromCacheValues(store.ConvertFromSearchResult(result));
|
||||
|
||||
DoAssert(doc, 1234, key, templateIdVal: null, 0, "/media/test.jpg", "Image", 23, "Shannon", "Shannon", 0, 0, "-1,1234", DateTime.Parse("2012-07-17T10:34:09"), DateTime.Parse("2012-07-16T10:34:09"), 2);
|
||||
@@ -220,7 +220,7 @@ namespace Umbraco.Tests.Cache.PublishedCache
|
||||
var xmlDoc = GetMediaXml();
|
||||
((XmlElement)xmlDoc.DocumentElement.FirstChild).SetAttribute("key", key.ToString());
|
||||
var navigator = xmlDoc.SelectSingleNode("/root/Image").CreateNavigator();
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var doc = cache.CreateFromCacheValues(cache.ConvertFromXPathNavigator(navigator, true));
|
||||
|
||||
DoAssert(doc, 2000, key, templateIdVal: null, 2, "image1", "Image", 23, "Shannon", "Shannon", 33, 33, "-1,2000", DateTime.Parse("2012-06-12T14:13:17"), DateTime.Parse("2012-07-20T18:50:43"), 1);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Umbraco.Tests.Macros
|
||||
//we DO want cache enabled for these tests
|
||||
var cacheHelper = new AppCaches(
|
||||
new ObjectCacheAppCache(),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
NoAppCache.Instance,
|
||||
new IsolatedCaches(type => new ObjectCacheAppCache()));
|
||||
//Current.ApplicationContext = new ApplicationContext(cacheHelper, new ProfilingLogger(Mock.Of<ILogger>(), Mock.Of<IProfiler>()));
|
||||
|
||||
@@ -77,8 +77,8 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
{
|
||||
var realCache = new AppCaches(
|
||||
new ObjectCacheAppCache(),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
new DictionaryAppCache(),
|
||||
new IsolatedCaches(t => new ObjectCacheAppCache()));
|
||||
|
||||
var provider = TestObjects.GetScopeProvider(Logger);
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace Umbraco.Tests.Persistence.Repositories
|
||||
|
||||
var realCache = new AppCaches(
|
||||
new ObjectCacheAppCache(),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
new DictionaryAppCache(),
|
||||
new IsolatedCaches(t => new ObjectCacheAppCache()));
|
||||
|
||||
var provider = TestObjects.GetScopeProvider(Logger);
|
||||
|
||||
@@ -118,8 +118,8 @@ namespace Umbraco.Tests.Published
|
||||
publishedContentTypeFactory.CreatePropertyType("prop1", 1),
|
||||
});
|
||||
|
||||
var elementsCache = new FastDictionaryCacheProvider();
|
||||
var snapshotCache = new FastDictionaryCacheProvider();
|
||||
var elementsCache = new FastDictionaryAppCache();
|
||||
var snapshotCache = new FastDictionaryAppCache();
|
||||
|
||||
var publishedSnapshot = new Mock<IPublishedSnapshot>();
|
||||
publishedSnapshot.Setup(x => x.SnapshotCache).Returns(snapshotCache);
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
internal IPublishedContent GetNode(int id, UmbracoContext umbracoContext)
|
||||
{
|
||||
var cache = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null),
|
||||
ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache,
|
||||
ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache,
|
||||
Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var doc = cache.GetById(id);
|
||||
Assert.IsNotNull(doc);
|
||||
@@ -126,7 +126,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -156,7 +156,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//ensure it is found
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -203,7 +203,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -231,7 +231,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -259,7 +259,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var searcher = indexer.GetSearcher();
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(1111);
|
||||
@@ -288,7 +288,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var searcher = indexer.GetSearcher();
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -314,7 +314,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
var ctx = GetUmbracoContext("/test");
|
||||
var searcher = indexer.GetSearcher();
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var cache = new PublishedMediaCache(ServiceContext.MediaService, ServiceContext.UserService, searcher, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
//we are using the media.xml media to test the examine results implementation, see the media.xml file in the ExamineHelpers namespace
|
||||
var publishedMedia = cache.GetById(3113);
|
||||
@@ -482,7 +482,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
</Image>");
|
||||
var node = xml.DescendantsAndSelf("Image").Single(x => (int)x.Attribute("id") == nodeId);
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
|
||||
var nav = node.CreateNavigator();
|
||||
|
||||
@@ -502,7 +502,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var errorXml = new XElement("error", string.Format("No media is maching '{0}'", 1234));
|
||||
var nav = errorXml.CreateNavigator();
|
||||
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryCacheProvider(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var publishedMedia = new PublishedMediaCache(new XmlStore((XmlDocument)null, null, null, null), ServiceContext.MediaService, ServiceContext.UserService, new DictionaryAppCache(), ContentTypesCache, Factory.GetInstance<IEntityXmlSerializer>());
|
||||
var converted = publishedMedia.ConvertFromXPathNodeIterator(nav.Select("/"), 1234);
|
||||
|
||||
Assert.IsNull(converted);
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Umbraco.Tests.Scoping
|
||||
// this is what's created core web runtime
|
||||
return new AppCaches(
|
||||
new DeepCloneAppCache(new ObjectCacheAppCache()),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
NoAppCache.Instance,
|
||||
new IsolatedCaches(type => new DeepCloneAppCache(new ObjectCacheAppCache())));
|
||||
}
|
||||
|
||||
@@ -949,14 +949,15 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// even though the underlying elements may not change (store snapshots)
|
||||
public PublishedSnapshot.PublishedSnapshotElements GetElements(bool previewDefault)
|
||||
{
|
||||
// note: using ObjectCacheRuntimeCacheProvider for elements and snapshot caches
|
||||
// note: using ObjectCacheAppCache for elements and snapshot caches
|
||||
// is not recommended because it creates an inner MemoryCache which is a heavy
|
||||
// thing - better use a StaticCacheProvider which "just" creates a concurrent
|
||||
// thing - better use a dictionary-based cache which "just" creates a concurrent
|
||||
// dictionary
|
||||
|
||||
// for snapshot cache, StaticCacheProvider MAY be OK but it is not thread-safe,
|
||||
// for snapshot cache, DictionaryAppCache MAY be OK but it is not thread-safe,
|
||||
// nothing like that...
|
||||
// for elements cache, StaticCacheProvider is a No-No, use something better.
|
||||
// for elements cache, DictionaryAppCache is a No-No, use something better.
|
||||
// ie FastDictionaryAppCache (thread safe and all)
|
||||
|
||||
ContentStore.Snapshot contentSnap, mediaSnap;
|
||||
SnapDictionary<int, Domain>.Snapshot domainSnap;
|
||||
@@ -998,11 +999,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
_contentGen = contentSnap.Gen;
|
||||
_mediaGen = mediaSnap.Gen;
|
||||
_domainGen = domainSnap.Gen;
|
||||
elementsCache = _elementsCache = new FastDictionaryCacheProvider();
|
||||
elementsCache = _elementsCache = new FastDictionaryAppCache();
|
||||
}
|
||||
}
|
||||
|
||||
var snapshotCache = new DictionaryCacheProvider();
|
||||
var snapshotCache = new DictionaryAppCache();
|
||||
|
||||
var memberTypeCache = new PublishedContentTypeCache(null, null, _serviceContext.MemberTypeService, _publishedContentTypeFactory, _logger);
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
private readonly XmlStore _xmlStore;
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
|
||||
public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCacheProvider, IMemberService memberService, PublishedContentTypeCache contentTypeCache)
|
||||
public PublishedMemberCache(XmlStore xmlStore, IAppCache requestCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache)
|
||||
{
|
||||
_requestCache = requestCacheProvider;
|
||||
_requestCache = requestCache;
|
||||
_memberService = memberService;
|
||||
_xmlStore = xmlStore;
|
||||
_contentTypeCache = contentTypeCache;
|
||||
|
||||
@@ -421,13 +421,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
/// </summary>
|
||||
/// <param name="node">The Xml node.</param>
|
||||
/// <param name="isPreviewing">A value indicating whether we are previewing or not.</param>
|
||||
/// <param name="cacheProvider">A cache provider.</param>
|
||||
/// <param name="appCache">A cache.</param>
|
||||
/// <param name="contentTypeCache">A content type cache.</param>
|
||||
/// <returns>The IPublishedContent corresponding to the Xml cache node.</returns>
|
||||
/// <remarks>Maintains a per-request cache of IPublishedContent items in order to make
|
||||
/// sure that we create only one instance of each for the duration of a request. The
|
||||
/// returned IPublishedContent is a model, if models are enabled.</remarks>
|
||||
public static IPublishedContent Get(XmlNode node, bool isPreviewing, IAppCache cacheProvider, PublishedContentTypeCache contentTypeCache)
|
||||
public static IPublishedContent Get(XmlNode node, bool isPreviewing, IAppCache appCache, PublishedContentTypeCache contentTypeCache)
|
||||
{
|
||||
// only 1 per request
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
var id = attrs?.GetNamedItem("id").Value;
|
||||
if (id.IsNullOrWhiteSpace()) throw new InvalidOperationException("Node has no ID attribute.");
|
||||
var key = CacheKeyPrefix + id; // dont bother with preview, wont change during request in Xml cache
|
||||
return (IPublishedContent) cacheProvider.Get(key, () => (new XmlPublishedContent(node, isPreviewing, cacheProvider, contentTypeCache)).CreateModel());
|
||||
return (IPublishedContent) appCache.Get(key, () => (new XmlPublishedContent(node, isPreviewing, appCache, contentTypeCache)).CreateModel());
|
||||
}
|
||||
|
||||
public static void ClearRequest()
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Umbraco.Web.Runtime
|
||||
// we need to have the dep clone runtime cache provider to ensure
|
||||
// all entities are cached properly (cloned in and cloned out)
|
||||
new DeepCloneAppCache(new WebCachingAppCache(HttpRuntime.Cache)),
|
||||
new DictionaryCacheProvider(),
|
||||
new DictionaryAppCache(),
|
||||
// we need request based cache when running in web-based context
|
||||
new HttpRequestAppCache(),
|
||||
new IsolatedCaches(type =>
|
||||
|
||||
Reference in New Issue
Block a user