FOUR-20944: Implement ETag Caching for Task and Case Data#7786
Merged
eiresendez merged 7 commits intoepic/FOUR-20929from Dec 6, 2024
Merged
FOUR-20944: Implement ETag Caching for Task and Case Data#7786eiresendez merged 7 commits intoepic/FOUR-20929from
eiresendez merged 7 commits intoepic/FOUR-20929from
Conversation
…on to prevent ETag inconsistencies
- Process only GET and HEAD methods to ensure middleware relevance and avoid unnecessary processing for non-cacheable HTTP methods. - Add a check to determine if the response is cacheable, filtering out non-cacheable responses (e.g., those with 'no-store' directive or non-cacheable status codes). - Default ETag generation now includes user-specific data (auth()->id()) to enforce personalized caching by default. - Removed 'scope' and 'includeUser' logic for simplified and consistent caching behavior.
- Refactored `EtagManager` to support dynamic ETag generation based on configurable sources (`updated_at`). - Introduced `generateEtagFromTables` with a `source` parameter for flexibility in determining the source of truth. This update prepares the app for future scalability and allows switching between different ETag generation strategies.
- Applied ETag middleware to the 'startProcesses' route for improved caching and reduced payload size. - Added default 'etag_tables' parameter set to 'processes' to optimize ETag generation for this route.
estebangallego
approved these changes
Dec 6, 2024
Contributor
estebangallego
left a comment
There was a problem hiding this comment.
Works as expected! 🔥
|
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.




Issue & Reproduction Steps
This PR implements ETag caching for all GET and HEAD requests, enhancing performance and reducing bandwidth usage by leveraging HTTP conditional requests. The middleware is now applied globally, ensuring consistent ETag handling across endpoints.
Solution
How to Test
• If using updated_at as the source, a 200 OK response is returned with the updated content.
Related Tickets & Packages
Code Review Checklist