From 2bdeefec16cb8a4e444b2873e563665951fffb28 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Wed, 26 Feb 2025 22:48:03 +0100 Subject: [PATCH] Pass preview to GetEntryOptions (#18470) --- .../Services/DocumentCacheService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.PublishedCache.HybridCache/Services/DocumentCacheService.cs b/src/Umbraco.PublishedCache.HybridCache/Services/DocumentCacheService.cs index a6af3b89ba..21758a1fcd 100644 --- a/src/Umbraco.PublishedCache.HybridCache/Services/DocumentCacheService.cs +++ b/src/Umbraco.PublishedCache.HybridCache/Services/DocumentCacheService.cs @@ -126,7 +126,7 @@ internal sealed class DocumentCacheService : IDocumentCacheService scope.Complete(); return contentCacheNode; }, - GetEntryOptions(key)); + GetEntryOptions(key, preview)); // We don't want to cache removed items, this may cause issues if the L2 serializer changes. if (contentCacheNode is null) @@ -209,13 +209,13 @@ internal sealed class DocumentCacheService : IDocumentCacheService ContentCacheNode? draftNode = await _databaseCacheRepository.GetContentSourceAsync(key, true); if (draftNode is not null) { - await _hybridCache.SetAsync(GetCacheKey(draftNode.Key, true), draftNode, GetEntryOptions(draftNode.Key)); + await _hybridCache.SetAsync(GetCacheKey(draftNode.Key, true), draftNode, GetEntryOptions(draftNode.Key, true)); } ContentCacheNode? publishedNode = await _databaseCacheRepository.GetContentSourceAsync(key, false); if (publishedNode is not null && HasPublishedAncestorPath(publishedNode.Key)) { - await _hybridCache.SetAsync(GetCacheKey(publishedNode.Key, false), publishedNode, GetEntryOptions(publishedNode.Key)); + await _hybridCache.SetAsync(GetCacheKey(publishedNode.Key, false), publishedNode, GetEntryOptions(publishedNode.Key, false)); } scope.Complete(); @@ -276,9 +276,9 @@ internal sealed class DocumentCacheService : IDocumentCacheService LocalCacheExpiration = _cacheSettings.Entry.Document.SeedCacheDuration }; - private HybridCacheEntryOptions GetEntryOptions(Guid key) + private HybridCacheEntryOptions GetEntryOptions(Guid key, bool preview) { - if (SeedKeys.Contains(key)) + if (SeedKeys.Contains(key) && preview is false) { return GetSeedEntryOptions(); }