CacheKey Object
The cacheKey object contains methods to modify a cacheKey for an HTTP request.
The cacheKey request object contains properties that optimize cached delivery by defining unique cached content. Unique cached content is typically a combination of the URL, query arguments, cookies, headers, or custom variables. cacheKey optimization ensures that the correct cached content is delivered and ultimately improves offload and performance.
The cacheKey request object contains properties specific to a given request.
👍 CacheKey request objects can only be modified during the
onClientRequestevent.
For more information about how to purge EdgeWorkers generated cacheKey modifications see Purge Methods.
excludeQueryString()
Sets the query string to exclude from the cache key.
📘 If you have URLs that yield different responses based on a unique path or query string, make sure you don’t exclude these differences in the cache key.
includeQueryString()
Sets the query string to include as part of the cache key. This is done by default, however it is provided as an API to be reverted to the default.
includeQueryArgument()
Sets a query argument to include as part of the cache key. This property can be called multiple times to include multiple query arguments. Calling this function once excludes all query arguments not explicitly included in a query argument from the cache key. By default, the entire query string is part of the cache key. This function takes precedence over “excludeQueryString()”. If both are called only the query parameters named in the includeQueryArgument property become part of the cache key.
Parameters
Review the table for information about the available parameters.
includeCookie()
Sets a cookie in the cache key. Can be called multiple times to include multiple cookies.
📘 You can only add cookies from a request generated by an end user. Cookies created in Property Manager or using
setHeaderin EdgeWorkers cannot be added into the cache key.
Parameters
Review the table for information about the available parameters.
includeHeader()
Sets an HTTP request header in the cache key. Can be called multiple times to include multiple headers.
📘 You can only add headers from a request generated be an end user. Headers created in Property Manager or using
setHeaderin EdgeWorkers cannot be added into the cache key.
Parameters
Review the table for information about the available parameters.
includeVariable()
Sets a Property Manager user-defined variable in the cache key. Can be called multiple times to include multiple variables.
Parameters
Review the table for information about the available parameters.