Great AppCaches renaming
This commit is contained in:
@@ -21,8 +21,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
internal class ContentCache : PublishedCacheBase, IPublishedContentCache, INavigableData, IDisposable
|
||||
{
|
||||
private readonly ContentStore.Snapshot _snapshot;
|
||||
private readonly ICacheProvider _snapshotCache;
|
||||
private readonly ICacheProvider _elementsCache;
|
||||
private readonly IAppCache _snapshotCache;
|
||||
private readonly IAppCache _elementsCache;
|
||||
private readonly DomainHelper _domainHelper;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
// it's too late for UmbracoContext which has captured previewDefault and stuff into these ctor vars
|
||||
// but, no, UmbracoContext returns snapshot.Content which comes from elements SO a resync should create a new cache
|
||||
|
||||
public ContentCache(bool previewDefault, ContentStore.Snapshot snapshot, ICacheProvider snapshotCache, ICacheProvider elementsCache, DomainHelper domainHelper, IGlobalSettings globalSettings, ILocalizationService localizationService)
|
||||
public ContentCache(bool previewDefault, ContentStore.Snapshot snapshot, IAppCache snapshotCache, IAppCache elementsCache, DomainHelper domainHelper, IGlobalSettings globalSettings, ILocalizationService localizationService)
|
||||
: base(previewDefault)
|
||||
{
|
||||
_snapshot = snapshot;
|
||||
@@ -259,7 +259,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return GetAtRootNoCache(preview);
|
||||
|
||||
// note: ToArray is important here, we want to cache the result, not the function!
|
||||
return (IEnumerable<IPublishedContent>)cache.GetCacheItem(
|
||||
return (IEnumerable<IPublishedContent>)cache.Get(
|
||||
CacheKeys.ContentCacheRoots(preview),
|
||||
() => GetAtRootNoCache(preview).ToArray());
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
internal class MediaCache : PublishedCacheBase, IPublishedMediaCache, INavigableData, IDisposable
|
||||
{
|
||||
private readonly ContentStore.Snapshot _snapshot;
|
||||
private readonly ICacheProvider _snapshotCache;
|
||||
private readonly ICacheProvider _elementsCache;
|
||||
private readonly IAppCache _snapshotCache;
|
||||
private readonly IAppCache _elementsCache;
|
||||
|
||||
#region Constructors
|
||||
|
||||
public MediaCache(bool previewDefault, ContentStore.Snapshot snapshot, ICacheProvider snapshotCache, ICacheProvider elementsCache)
|
||||
public MediaCache(bool previewDefault, ContentStore.Snapshot snapshot, IAppCache snapshotCache, IAppCache elementsCache)
|
||||
: base(previewDefault)
|
||||
{
|
||||
_snapshot = snapshot;
|
||||
@@ -63,7 +63,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return GetAtRootNoCache();
|
||||
|
||||
// note: ToArray is important here, we want to cache the result, not the function!
|
||||
return (IEnumerable<IPublishedContent>)cache.GetCacheItem(
|
||||
return (IEnumerable<IPublishedContent>)cache.Get(
|
||||
CacheKeys.MediaCacheRoots(false), // ignore preview, only 1 key!
|
||||
() => GetAtRootNoCache().ToArray());
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor;
|
||||
public readonly IVariationContextAccessor VariationContextAccessor;
|
||||
private readonly IEntityXmlSerializer _entitySerializer;
|
||||
private readonly ICacheProvider _snapshotCache;
|
||||
private readonly IAppCache _snapshotCache;
|
||||
private readonly IMemberService _memberService;
|
||||
private readonly PublishedContentTypeCache _contentTypeCache;
|
||||
private readonly bool _previewDefault;
|
||||
|
||||
public MemberCache(bool previewDefault, ICacheProvider snapshotCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IEntityXmlSerializer entitySerializer)
|
||||
public MemberCache(bool previewDefault, IAppCache snapshotCache, IMemberService memberService, PublishedContentTypeCache contentTypeCache, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor, IEntityXmlSerializer entitySerializer)
|
||||
{
|
||||
_snapshotCache = snapshotCache;
|
||||
_publishedSnapshotAccessor = publishedSnapshotAccessor;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
{
|
||||
CacheValues cacheValues;
|
||||
PublishedSnapshot publishedSnapshot;
|
||||
ICacheProvider cache;
|
||||
IAppCache cache;
|
||||
switch (cacheLevel)
|
||||
{
|
||||
case PropertyCacheLevel.None:
|
||||
@@ -161,11 +161,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return cacheValues;
|
||||
}
|
||||
|
||||
private CacheValues GetCacheValues(ICacheProvider cache)
|
||||
private CacheValues GetCacheValues(IAppCache cache)
|
||||
{
|
||||
if (cache == null) // no cache, don't cache
|
||||
return new CacheValues();
|
||||
return (CacheValues) cache.GetCacheItem(ValuesCacheKey, () => new CacheValues());
|
||||
return (CacheValues) cache.Get(ValuesCacheKey, () => new CacheValues());
|
||||
}
|
||||
|
||||
// this is always invoked from within a lock, so does not require its own lock
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
var cache = GetCurrentSnapshotCache();
|
||||
return cache == null
|
||||
? GetProfileNameByIdNoCache(id)
|
||||
: (string)cache.GetCacheItem(CacheKeys.ProfileName(id), () => GetProfileNameByIdNoCache(id));
|
||||
: (string)cache.Get(CacheKeys.ProfileName(id), () => GetProfileNameByIdNoCache(id));
|
||||
}
|
||||
|
||||
private static string GetProfileNameByIdNoCache(int id)
|
||||
@@ -328,7 +328,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return GetChildren();
|
||||
|
||||
// note: ToArray is important here, we want to cache the result, not the function!
|
||||
return (IEnumerable<IPublishedContent>)cache.GetCacheItem(ChildrenCacheKey, () => GetChildren().ToArray());
|
||||
return (IEnumerable<IPublishedContent>)cache.Get(ChildrenCacheKey, () => GetChildren().ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
#region Caching
|
||||
|
||||
// beware what you use that one for - you don't want to cache its result
|
||||
private ICacheProvider GetAppropriateCache()
|
||||
private IAppCache GetAppropriateCache()
|
||||
{
|
||||
var publishedSnapshot = (PublishedSnapshot)_publishedSnapshotAccessor.PublishedSnapshot;
|
||||
var cache = publishedSnapshot == null
|
||||
@@ -394,7 +394,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
return cache;
|
||||
}
|
||||
|
||||
private ICacheProvider GetCurrentSnapshotCache()
|
||||
private IAppCache GetCurrentSnapshotCache()
|
||||
{
|
||||
var publishedSnapshot = (PublishedSnapshot)_publishedSnapshotAccessor.PublishedSnapshot;
|
||||
return publishedSnapshot?.SnapshotCache;
|
||||
@@ -436,7 +436,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
var cache = GetAppropriateCache();
|
||||
if (cache == null) return new PublishedContent(this).CreateModel();
|
||||
return (IPublishedContent)cache.GetCacheItem(AsPreviewingCacheKey, () => new PublishedContent(this).CreateModel());
|
||||
return (IPublishedContent)cache.Get(AsPreviewingCacheKey, () => new PublishedContent(this).CreateModel());
|
||||
}
|
||||
|
||||
// used by Navigable.Source,...
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
public MediaCache MediaCache;
|
||||
public MemberCache MemberCache;
|
||||
public DomainCache DomainCache;
|
||||
public ICacheProvider SnapshotCache;
|
||||
public ICacheProvider ElementsCache;
|
||||
public IAppCache SnapshotCache;
|
||||
public IAppCache ElementsCache;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
@@ -48,9 +48,9 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
#region Caches
|
||||
|
||||
public ICacheProvider SnapshotCache => Elements.SnapshotCache;
|
||||
public IAppCache SnapshotCache => Elements.SnapshotCache;
|
||||
|
||||
public ICacheProvider ElementsCache => Elements.ElementsCache;
|
||||
public IAppCache ElementsCache => Elements.ElementsCache;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -932,7 +932,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
#region Create, Get Published Snapshot
|
||||
|
||||
private long _contentGen, _mediaGen, _domainGen;
|
||||
private ICacheProvider _elementsCache;
|
||||
private IAppCache _elementsCache;
|
||||
|
||||
public override IPublishedSnapshot CreatePublishedSnapshot(string previewToken)
|
||||
{
|
||||
@@ -960,7 +960,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
|
||||
ContentStore.Snapshot contentSnap, mediaSnap;
|
||||
SnapDictionary<int, Domain>.Snapshot domainSnap;
|
||||
ICacheProvider elementsCache;
|
||||
IAppCache elementsCache;
|
||||
lock (_storesLock)
|
||||
{
|
||||
var scopeContext = _scopeProvider.Context;
|
||||
@@ -998,11 +998,11 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
_contentGen = contentSnap.Gen;
|
||||
_mediaGen = mediaSnap.Gen;
|
||||
_domainGen = domainSnap.Gen;
|
||||
elementsCache = _elementsCache = new DictionaryCacheProvider();
|
||||
elementsCache = _elementsCache = new FastDictionaryCacheProvider();
|
||||
}
|
||||
}
|
||||
|
||||
var snapshotCache = new StaticCacheProvider();
|
||||
var snapshotCache = new DictionaryCacheProvider();
|
||||
|
||||
var memberTypeCache = new PublishedContentTypeCache(null, null, _serviceContext.MemberTypeService, _publishedContentTypeFactory, _logger);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user