FTM: Add caching to ESContentFactoryImpl#findContentletByIdentifier to optimize queries with the publishDate parameter
Nobody has claimed this yet.
- #31293 by @fabrizzio-dotCMS — closed without merging
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Parent Issue
No response
User Story
Currently, the method ESContentFactoryImpl#findContentletByIdentifier(final String identifier, final long languageId, final String variantId, final Date timeMachineDate) executes direct database queries when collections with the Time Machine feature are queried using the publishDate parameter set to a future date.
This behavior creates a vulnerability where malicious users could misuse URLs with the publishDate parameter to overload the database with unnecessary queries. To mitigate this risk, caching should be introduced for this method.
since FTM gets triggered by passing the publishDate param, add a condition to prevent FTM from getting triggered unless the publishDate is the present day including a specific time
if (publishDate == today && publishDate does not have time){
publishDate = null
}
Acceptance Criteria
• The method leverages a caching mechanism to prevent repeated direct queries to the database.
• The cache is invalidated automatically when changes occur to the page structure \(e.g., content updates, page deletions, or publishing actions\).
• Performance improvements are observed during testing, particularly when multiple queries use the publishDate parameter with similar configurations.
Proposed Objective
Security & Privacy
Proposed Priority
Please Select
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.
No response
Assumptions & Initiation Needs
No response
Quality Assurance Notes & Workarounds
No response
Sub-Tasks & Estimates
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ESContentFactoryImpl#findContentletByIdentifier and trace how the publishDate parameter reaches direct database queries. Identify existing caching and page-structure change paths, then verify repeated publishDate queries, invalidation after content updates, deletions, and publishing actions, and the present-day condition described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, databases, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100