Great AppCaches renaming

This commit is contained in:
Stephan
2019-01-17 11:01:23 +01:00
parent 67e4703821
commit 0bee01e0ee
108 changed files with 1538 additions and 1440 deletions

View File

@@ -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());
}

View File

@@ -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());
}

View File

@@ -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;

View File

@@ -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

View File

@@ -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,...

View File

@@ -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

View File

@@ -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);