Controlling Cache
The Edgemesh® global cache ensures fast and up-to-date reflection of your latest code changes by continuously revalidating HTML pages. Resources like javascript, stylesheets, and images are revalidated on a configurable 15-minute interval. You can set this configuration via the Edgemesh® Portal.
If you need to clear or revalidate caches for specific resources without purging the global cache, Edgemesh® provides convenient utilities to control cache behavior in your region. These tools allow you to maintain efficient cache management while ensuring the accuracy of specific resource updates.
Bypassing the Edge Cache
To bypass the edge cache and optimizations for a page or resource, simply add the ?em-bypass=server search parameter. This instructs Edgemesh® to fetch the page directly from the upstream origin, without any enhancements, and return it to the browser. This capability is especially useful for debugging purposes when you need to determine if an edge optimization is impacting your code. By utilizing the em-bypass parameter, you can quickly assess the original state of your page without any interference from the caching and optimization mechanisms.
Revalidating the Edge Cache
To initiate a revalidation of the edge cache in your region, simply add the ?em-cache=revalidate search parameter to any page or resource. By doing so, Edgemesh® Server will serve you the current cached resource while simultaneously updating the cache in the background. This allows you to access the most up-to-date version of the resource without experiencing any disruptions.
Purging the Edge Cache
To purge the edge cache in your region, simply add the ?em-cache=purge search parameter to any page or resource. This instructs Edgemesh® Server to clear the cache for the specified resource and serve you the response directly from the upstream origin. The response is then optimized and stored in the edge cache for subsequent requests. It's important to note that purging the cache completely removes the cached content, while revalidation updates the cache in the background without dropping it. Revalidation is generally preferred for optimal performance, as other users in the region will continue to receive cached responses. Before using the purge option, consider if it is truly necessary, as in most cases, bypassing the cache using the em-bypass
parameter allows you to see the response directly from the upstream origin.
Cache Purges via Webhooks
The Edgemesh® Server global cache can be purged programmatically using the Edgemesh® API. This API feature is beneficial for automating cache clearance based on specific events, such as product availability changes or theme updates. By setting up webhooks, you can trigger cache purges whenever necessary, eliminating the need to wait for the edge cache to revalidate. This automation capability empowers you to schedule updates and ensure that the latest content is promptly delivered to your users.