Decouple NuCache.Property from NuCache.PublishedSnapshot

This commit is contained in:
Lars-Erik
2021-07-19 12:55:13 +02:00
committed by Nathan Woulfe
parent deedb24b65
commit f7428ac67b

View File

@@ -124,7 +124,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
private CacheValues GetCacheValues(PropertyCacheLevel cacheLevel) private CacheValues GetCacheValues(PropertyCacheLevel cacheLevel)
{ {
CacheValues cacheValues; CacheValues cacheValues;
PublishedSnapshot publishedSnapshot; IPublishedSnapshot publishedSnapshot;
IAppCache cache; IAppCache cache;
switch (cacheLevel) switch (cacheLevel)
{ {
@@ -141,7 +141,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
// elements cache (if we don't want to pollute the elements cache with short-lived // elements cache (if we don't want to pollute the elements cache with short-lived
// data) depending on settings // data) depending on settings
// for members, always cache in the snapshot cache - never pollute elements cache // for members, always cache in the snapshot cache - never pollute elements cache
publishedSnapshot = (PublishedSnapshot) _publishedSnapshotAccessor.PublishedSnapshot; publishedSnapshot = _publishedSnapshotAccessor.PublishedSnapshot;
cache = publishedSnapshot == null cache = publishedSnapshot == null
? null ? null
: ((_isPreviewing == false || PublishedSnapshotService.FullCacheWhenPreviewing) && (_isMember == false) : ((_isPreviewing == false || PublishedSnapshotService.FullCacheWhenPreviewing) && (_isMember == false)
@@ -151,7 +151,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
break; break;
case PropertyCacheLevel.Snapshot: case PropertyCacheLevel.Snapshot:
// cache within the snapshot cache // cache within the snapshot cache
publishedSnapshot = (PublishedSnapshot) _publishedSnapshotAccessor.PublishedSnapshot; publishedSnapshot = _publishedSnapshotAccessor.PublishedSnapshot;
cache = publishedSnapshot?.SnapshotCache; cache = publishedSnapshot?.SnapshotCache;
cacheValues = GetCacheValues(cache); cacheValues = GetCacheValues(cache);
break; break;