Cache Invalidation
The Cache Invalidation API provides a set of calls for managing and updating cached content to ensure that applications always deliver the most up-to-date and relevant data to their users.
Cloudflare
When using Cloudflare, an additional WAF (Web Application Firewall) rule must be created to ensure that BAN or PURGE requests from Cloudflare are not blocked. More information on configuring the WAF rule is described in the Cloudflare setup.
Flush-URL
The "Flush-URL" call allows you to clear the cache of a specific URL. Whether it's the homepage or a specific resource that needs to be updated, this API call ensures that the latest version of the content is retrieved from the origin server. The request can be used as follows:
Flush-File
The "Flush-File" call is designed for cases where specific files in the cache need to be invalidated. This is especially useful for static resources like HTML, CSS, or JavaScript files. The call ensures that a specific file is always fetched fresh from the origin server. The request can be used as follows:
The hash of the cache file is returned as a response header if the Debug Header option is enabled.
Flush-Tags
The "Flush-Tags" call introduces a tagging system into cache management. Tags can be associated with cached items using the "x-cache-tags" header. If content related to specific tags needs to be invalidated, this call efficiently achieves that. For example:
If multiple tags are to be deleted, a request with a list of tags can be submitted. The tags should be passed as a comma-separated list.
Use cases and ideas for the application of Flush-Tags can be found in the Best Practices documentation.
Flush-All
In certain scenarios, it may be necessary to clear the entire cache. The "Flush-All" call provides a way to delete all cached content and start fresh with data from the origin server. The request can be used as follows:
Last updated