Conversation
…edContentFactory.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds request cache availability checks before using the request cache in PublishedContentFactory. The changes ensure that the cache is only accessed when available, addressing an omission from a previous PR that introduced request caching around IPublishedContent construction.
Key changes:
- Added
IsAvailablechecks before all cache read operations - Added
IsAvailablechecks before all cache write operations - Initialized variables to null when cache is unavailable
src/Umbraco.PublishedCache.HybridCache/Factories/PublishedContentFactory.cs
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Rectifies an omission in #19990
Description
In #19990 a request cache was added around the construction of
IPublishedContentinstances. It didn't have a check that the request cache was available. As far as I can see this doesn't cause any issues at runtime as the calls to the cache gracefully handle if it can't be supported, but I figured it was better to be explicit and make this check.Testing
Verify existing integration tests pass, and consider adding breaking points or debug logging configuration to verify the cache is used when the item has already been retrieved in the current request.