Including device type in the cache key ensures that content is appropriately cached and served based on the user’s device. This enhances performance by delivering device-specific cached content, improving load times and user experience.
Loading...
https://www.edgecompute.live/edgeworkers/personalization/cachekeyDevicetype
Copied to clipboard!
This example includes the device type (tablet or mobile) from a PMUSER variable in the computed cache key for an Edge Server.
Cache Integration
Combine performance benefits from CDN caching with dynamic edge compute logic.
Device Heuristics
Customize dynamic behavior based on the user's device.
Related Examples
View More
Dynamic Callback
Demonstrates how an EdgeWorker can wrap a JSON response with a dynamic unique callback function leveraging Response Provider and Stream API for efficient content transformation. The EdgeWorker should be enabled on JSON requests containing a callback query parameter, which can be managed via Property Manager. When such a request comes in, this EdgeWorker removes the callback query parameter, makes a sub-request to fetch the JSON data, and serves it as a stream. The EdgeWorker code adds a prefix with the callback function name captured from the query parameter and a suffix. Both JSON data and transformed data can be cached using standard ““Caching”” behavior in Property Manager if caching is allowed.