RealComposer
Performance & Edge

Surrogate Keys

Direct Definition

Surrogate keys are cache tags attached to HTTP responses so a CDN can purge every cached object that shares a label without knowing each URL. An edge gateway can emit Surrogate-Key headers on catalog or CMS API responses, then purge by product ID or locale when upstream data changes.

Technical Architecture & Deep-Dive

URL-only invalidation breaks down when one record appears under many paths or query variants. Surrogate keys group variants by business identity, such as `product-42` or `locale-en`.

On cacheable GET gateways, workers add surrogate keys after fetching upstream JSON, store them in the CDN metadata, and call the provider purge API when webhooks fire. Pair keys with normalized cache keys so irrelevant query params do not fragment the cache while still allowing precise invalidation.

Key Architectural Benefits

Purges related API responses without a full cache flush.
Maps business events to cache entries more reliably than URL lists.
Keeps high hit ratios while maintaining fresher catalog data.
REALCOMPOSER EDGE WORKSPACE

Implement Surrogate Keys at the Edge

Deploy lightweight API aggregation, edge caching, and secret injection in minutes without Docker containers or complex servers.

START BUILDING FREE

Frequently Asked Questions

Q:Are surrogate keys visible to browsers?

They are primarily for shared caches. Some platforms strip them at the client edge. Design purges through your CDN or edge provider APIs.

Related Architecture Concepts

Ready-to-Use Edge Recipes