Shard cache using custom cache key values
Enterprise customers can now optimize cache hit ratios for content that varies by device, language, or referrer by sharding cache using up to ten values from previously restricted headers with custom cache keys.
When configuring custom cache keys, you can now include values from these headers to create distinct cache entries:
accept*headers (for example,accept,accept-encoding,accept-language): Serve different cached versions based on content negotiation.refererheader: Cache content differently based on the referring page or site.user-agentheader: Maintain separate caches for different browsers, devices, or bots.
- Content varies significantly by device type (mobile vs desktop).
- Different language or encoding preferences require distinct responses.
- Referrer-specific content optimization is needed.
{ "cache_key": { "custom_key": { "header": { "include": ["accept-language", "user-agent"], "check_presence": ["referer"] } } }}This configuration creates separate cache entries based on the accept-language and user-agent headers, while also considering whether the referer header is present.
To get started, refer to the custom cache keys documentation.