PublishedContent - the big refactoring

This commit is contained in:
Stephan
2013-09-05 17:47:13 +02:00
parent 912716f889
commit 0415a31d0e
115 changed files with 6366 additions and 6233 deletions

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.CompilerServices;
namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
static class UmbracoContextCache
{
static readonly ConditionalWeakTable<UmbracoContext, ConcurrentDictionary<string, object>> Caches
= new ConditionalWeakTable<UmbracoContext, ConcurrentDictionary<string, object>>();
public static ConcurrentDictionary<string, object> Current
{
get
{
var umbracoContext = UmbracoContext.Current;
// will get or create a value
// a ConditionalWeakTable is thread-safe
// does not prevent the context from being disposed, and then the dictionary will be disposed too
return umbracoContext == null ? null : Caches.GetOrCreateValue(umbracoContext);
}
}
}
}