Performance & Edge

Cache Key

Direct Definition

A cache key is the unique identifier a cache uses to store and look up a response. It is typically built from the request URL and may include query parameters, selected headers, or user attributes. Two requests with the same cache key receive the same cached response.

Technical Architecture & Deep-Dive

Designing cache keys is a balance. Keys that are too broad risk serving one user data to another, while keys that are too specific fragment the cache and lower hit ratios.

For public API data like product catalogs or weather, a key based on the normalized URL works well. For per-user data, the key must include a user or tenant identifier, or the response should not be shared at all. Edge platforms allow custom cache keys so gateways can ignore irrelevant query parameters and include only meaningful variation.

Key Architectural Benefits

Controls exactly which requests share cached responses.
Normalizing keys increases hit ratios and reduces upstream calls.
Including identity in keys prevents cross-user data leaks.
REALCOMPOSER EDGE WORKSPACE

Implement Cache Key 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:Should authorization headers be part of a cache key?

If responses vary by user, yes, or better, do not cache them in shared caches. Public responses should exclude auth headers from the key to maximize reuse.

Related Architecture Concepts

Ready-to-Use Edge Recipes