feat: add surrogate key caching to search results#266
Merged
Conversation
7184ce3 to
00c066d
Compare
Search result pages were completely uncached at the CDN level. Add Surrogate-Key (search all) and Cache-Control headers to search responses that contain a query, and include 'search' in the purgeDrinkCache surrogate keys so search results are invalidated whenever a drink is created, updated, or deleted. Co-Authored-By: Claude Opus 4.6 <[email protected]>
00c066d to
b7abdeb
Compare
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.
Summary
Surrogate-Key: search allandCache-Controlheaders to search result responses (both with and without results) so Fastly can cache themsearchto the surrogate keys purged inpurgeDrinkCache()so cached search results are invalidated on drink mutationsTest plan
/search(no query) and verifySurrogate-Key: allheader is present (nosearchkey — this page is just UI with no drink data)/search?q=margaritaand verifySurrogate-Key: search allandCache-Controlheaders are present/search?q=nonexistent(no results) and verify the same headers are presentsearchsurrogate key🤖 Generated with Claude Code