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.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?