Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

feat: add surrogate key caching to search results#266

Merged
wKovacs64 merged 1 commit intomainfrom
cache-search-results
Feb 22, 2026
Merged

feat: add surrogate key caching to search results#266
wKovacs64 merged 1 commit intomainfrom
cache-search-results

Conversation

@wKovacs64
Copy link
Owner

@wKovacs64 wKovacs64 commented Feb 22, 2026

Summary

  • Add Surrogate-Key: search all and Cache-Control headers to search result responses (both with and without results) so Fastly can cache them
  • Add search to the surrogate keys purged in purgeDrinkCache() so cached search results are invalidated on drink mutations

Test plan

  • Visit /search (no query) and verify Surrogate-Key: all header is present (no search key — this page is just UI with no drink data)
  • Visit /search?q=margarita and verify Surrogate-Key: search all and Cache-Control headers are present
  • Visit /search?q=nonexistent (no results) and verify the same headers are present
  • Create/update/delete a drink in admin and verify the Fastly purge request includes the search surrogate key

🤖 Generated with Claude Code

@wKovacs64 wKovacs64 force-pushed the cache-search-results branch 3 times, most recently from 7184ce3 to 00c066d Compare February 22, 2026 06:01
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]>
@wKovacs64 wKovacs64 force-pushed the cache-search-results branch from 00c066d to b7abdeb Compare February 22, 2026 06:04
@wKovacs64 wKovacs64 merged commit 786249a into main Feb 22, 2026
8 checks passed
@wKovacs64 wKovacs64 deleted the cache-search-results branch February 22, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant