Skip to content

Verify that the request cache is available before using it in PublishedContentFactory#20062

Merged
kjac merged 2 commits intomainfrom
v16/improvement/check-request-cache-availaibility
Sep 4, 2025
Merged

Verify that the request cache is available before using it in PublishedContentFactory#20062
kjac merged 2 commits intomainfrom
v16/improvement/check-request-cache-availaibility

Conversation

@AndyButland
Copy link
Contributor

@AndyButland AndyButland commented Sep 3, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

Rectifies an omission in #19990

Description

In #19990 a request cache was added around the construction of IPublishedContent instances. 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.

Copilot AI review requested due to automatic review settings September 3, 2025 06:23
@AndyButland AndyButland changed the title Verify that the request cache is available before using it in Publish… Verify that the request cache is available before using it in PublishedContentFactory Sep 3, 2025

This comment was marked as outdated.

@AndyButland AndyButland requested a review from Copilot September 3, 2025 06:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IsAvailable checks before all cache read operations
  • Added IsAvailable checks before all cache write operations
  • Initialized variables to null when cache is unavailable

Copy link
Contributor

@kjac kjac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised 👍

@kjac kjac merged commit 91ce518 into main Sep 4, 2025
25 checks passed
@kjac kjac deleted the v16/improvement/check-request-cache-availaibility branch September 4, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants