Overview: Output and client cache
With Sitefinity CMS, you can configure the way your content and pages are cached which affects and optimizes the overall performance of your system.You do this by configuring cache profiles that include both the output and client cache. You can apply cache profiles globally on application level or choose which specific profile to apply on a page or library level. Cache profiles have a similar structure. For details, see Configure and manage cache profiles.
You can configure the following types of cache:
- Output cache
Output cache is stored on the server.
- Client cache
Client cache is stored on the browser.
Output cache
You can apply output caching on page and library level.
When applying output cache on page level (including personalized pages), Sitefinity CMS caches all rendered output, including widgets. Sitefinity CMS caches a different cache variation for each personalization segment of the page. On widget level, Sitefinity CMS performs cache substitution whenever a widget has an inherent dynamic behavior. For example, this is the case of the login name, login status, and so on. Sitefinity CMS also has output cache for anonymous forum users.
Sitefinity CMS performs post cache substitution – these widgets are written using Razor syntax and right after the cached page is about to be served, Sitefinity CMS injects the string that the widget's HTML output into the response.
Output cache is stored in the memory and is cleared on application start.
You can have only one default cache profile, which is used by default for all pages. You can, however, change the cache profile on page level. Thus, you have different cache behaviors for different pages (sections of your site). Once a page is requested, and if the page is not found on the server output cache, Sitefinity CMS reads the output cache and output cache profile settings to determine whether it should add the page in cache and with what settings. Each consecutive request for the same page is served from cache, unless:
- You configured the page not to use caching
- You disabled output cache globally
- The cache duration of the page has expired or someone has modified it.
This results in invalidation of the cache.
By default, Sitefinity CMS output cache varies by user agent (web browser), meaning that the system creates different cached versions of the page depending on the user agent (web browser) the page is requested from.
Output cache is disabled by default for logged in users that have backend (administrative) access and are browsing the site. Thus, the users can observe the effect of their changes immediately.
Client cache
Sitefinity CMS caches pages and media content (images, documents, videos) on the client browser. By adding a Cache-Control header to the response of the request, the browser can cache the pages and media. As a result, the amount of server request decreases. You can configure any Sitefinity CMS pages and libraries to use both server caching and client (browser) caching of content. The expiration of content in cache is configured by setting the appropriate client cache profile for the page or library. For more information, see Configure and manage cache profiles.
Sitefinity CMS combines static resources such as JavaScript and CSS files, which can greatly reduce loading time. By default Sitefinity CMS also enables client caching which allows the browser to cache these web resources for every subsequent request.
In addition, you can configure CDN and proxy server support for pages or media items. For more information, see Use CDN storage for content libraries.