Extend the default caching behavior

Configuring and using caching substantially increases the performance of your web application. When your pages are cached, on page request, they are immediately served from the cache.

However, in some cases you may want to keep most of the page cached, but change dynamically only a small portion of the page. 

EXAMPLE: Consider the case when the behavior of a widgets depends on the user input – if a user selects a checkbox on the page, the widget displays different content. If the whole page is cached, the change will not be immediately visible, because the page is served from the cache. The change will be visible only after the cache expires or is invalidated for some other reason.

In this case, you can use ASP.NET post-cache substitution. This way, you keep most of the page content cached, but substitute dynamically only the required widget.

Following are some examples you can use to modify the default cache behavior:

  • Substitute cache using a substitution widget
    Using this approach, you keep a page cached and exempt from the cache only one particular widget.
  • Override the PageRouteHandler
    Using this approach, you can create a cache that is not browser specific.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?