In Cloudvanti we use CDN to make the website performance better by caching the website data. This CDN cache is refreshed when the cache time is expired. Sometimes when we made an update to the website page, the cache will not be updated straightaway until the cache is expired. To solve this issue, Sitefinity has a feature called Cached Invalidation. This feature will make the cache updated right away when the page is updated.

Invalidate CDN Cache

Cache invalidation can be integrated into CDN by using Webhook that is only available on Sitefinity 12.2 and above. To invalidate cache on the CDN level, Cloudvanti provides middleware applications in Azure Function to automate the cache invalidation process. So whenever the content is updated in Sitefinity it will trigger a webhook OutputCache Invalidation Event to trigger Azure Function to Purge cache in CDN.

To activate the cached invalidation, we need to setup the Sitefinity webhook and output cache.

Sitefinity Webhook

Sitefinity Webhook allows user to subscribe to different Sitefinity events, such as:

  • Telerik.Sitefinity.Web.OutputCache.IOutputCacheInvalidationEvent
  • Telerik.Sitefinity.Web.Events.ILoginCompletedEvent
  • Telerik.Sitefinity.Modules.Forms.Events.IFormEntryCreatedEvent

By subscribing to one of those events, we can do the additional extra processes in the backend. For example, we implement "Telerik.Sitefinity.Modules.Forms.Events.IFormEntryCreatedEvent", when User submits the form we can add additional processes to capture that data and submitted to a CRM immediately.

For Cloudvanti itself, by default, we implement the "Telerik.Sitefinity.Web.OutputCache.IOutputCacheInvalidationEvent" to handle the cache to update the cache immediately. Each time there's an update from a user, Sitefinity webhook will purge cache and the content is updated directly on the website. To make Cache Invalidation works, make sure you Setting Up Webhook and Setting Up Output Cache first in your Sitefinity backend by following these steps.

Setting Up Webhook

To set up the Webhook, do the following:

  1. Install Sitefinity Webhook in Administration >> Module & Services



  2. Make sure Webhook is active. If not, install it or activate it


Setting Up Sitefinity Output Cache

Output cache is the caching layer that gets hit by incoming requests and guarantees that content is served instantly from cache instead of being processed on the server every time. We can invalidate this output cache by utilizing Sitefinity Webhook.

To activate Output Cache on Sitefinity, go to Administration >> Settings >> Advanced >> System >>Output Cache Settings. The following is the image of Output Cache Settings.

Webhook will invalidate the output cache for these actions:

  • Publish
  • Unpublish
  • Delete

This will be applicable for Page, Content Widget, and Dynamic Widget.

Once the page is cached and one of these actions is executed, the cache for the page will be invalidated.

For example,

  1. Page under /testPage is cached
  2. Update Content in /testPage and Publish it.
  3. Cache in /testPage will be invalidated.

If a Widget is in use by multiple pages, all of those pages' cache also will be invalidated by a single action.

Supporting Documents:

Output cache functionality and behavior in Sitefinity
Storing configuration values in the web.config AppSetting section