fix(Cache): Added subkey to page cache to include contentlet information (Live mode only) + Clean up cache logic#34507
fix(Cache): Added subkey to page cache to include contentlet information (Live mode only) + Clean up cache logic#34507ihoffmann-dot wants to merge 2 commits intomainfrom
Conversation
…ion (Live mode only) + Clean up cache logic
|
|
||
| //Remove from block cache. | ||
| CacheLocator.getBlockPageCache().remove(htmlPage); | ||
| // CacheLocator.getBlockPageCache().remove(htmlPage); |
There was a problem hiding this comment.
why is this line commented?
There was a problem hiding this comment.
This method was being called but was not implemented, so it wasn’t doing anything. I can remove the line directly if needed
| * @param htmlPage the IHTMLPage | ||
| * @param request the HttpServletRequest | ||
| */ | ||
| private void cleanOldCachedPages(long langId, IHTMLPage htmlPage, HttpServletRequest request) { |
There was a problem hiding this comment.
Shall we add test to this new method?
There was a problem hiding this comment.
Actually, we don't need this method - the Page cache uses a TTL and evicts the expired entries automatically.
| @@ -153,7 +155,7 @@ public final void serve(final OutputStream out) throws DotDataException, IOExcep | |||
|
|
|||
| } | |||
There was a problem hiding this comment.
I don't think we need any of this code. Instead, in the VelocityUtil.shouldPageCache we need to check if we are in AdminMode and if so, return false. We should never be caching a page from the backend.
There was a problem hiding this comment.
I agree, Will. We have been caching pages in the BE for a while, and we have recently discovered some odd behaviors in UVE that disappear when we flush the cache
Summary
Added a subkey to page cache to include contentlet information (Live mode only) and cleaned up cache logic to improve caching efficiency.
Changes
Motivation
The issue addressed by this PR is caused by the lack of a mechanism to identify changes made to contentlets (additions, reordering, or deletions) within a Page and have those changes properly reflected in LIVE mode, in Traditional DotCMS. As a result, incorrect information can be displayed and we can have inconsistency between LIVE mode and the actual page.
These changes improve the page caching mechanism by including contentlet information in the cache key, allowing for more precise cache invalidation and better handling of page variations based on their content.
Related Issue
Fixes [DEFECT] Browser displays unpublished version of pages, not respecting Live mode #34405