Configure cache profiles

With Sitefinity CMS, you can configure both client and output cache profiles on application level for pages and media libraries. You can easily create and manage global cache profiles for pages and media libraries in the Administration section of Sitefinity CMS. To do so, navigate to Administration » Settings » Global settings » Cache profiles.

NOTE: In case you need to configure cache headers, you need to do it in Sitefinity CMS Advanced settings section. For more information, see Configure cache headers for page and media cache profiles section in this article. 

By setting global cache profiles on application level, you get a built-it mechanism to cache pages on the client, based on controlling the cache-control header of the page, allowing to send a standard HTTP cache-control header that instructs the client to cache the page for the configured time. You thus optimize your site's performance by reducing the number of requests on the original server by caching the page response on browser, proxy server or CDN for a specific amount of time and reused in other subsequent requests.  

NOTE: You cannot delete default cache profiles.

For each cache profile, you can see the details, summarized in the following table.

Property  Description 
Name  Defines the programmatic name of the profile. This is the name used to access the profile. 
Cache location 

Specifies the location of the cached HTTP response content. You can choose one of the following values:

  • No cache
    No cache profile is applied, the client sends new requests and the server generates content for the responseon every request
  • Server
    Cache is applied only on the server, the client still sends new requests
  • Browser
    Cache is applied only on the client, the server generates content every time there is a request to it
  • Browser and server
    Cache is applied both on client and on the original (hosting) server, that is, not just any proxy server
  • Browser, proxy and local server
    Cache is applied on the browser client (where the request originated), on a proxy server and any other server participating in the request (where the request was processed)
Server max age  Specifies the maximum time in seconds that the fetched response is allowed to be reused from the time of the request.
Browser max age  Specifies the maximum time in seconds that the fetched response is allowed to be reused from the time of the request. Corresponds to the max-age directive of the cache-control header. If this value is not specified, the system uses the client caching and the Duration property sets the client cache max age. 
Proxy or CDN max age  This setting corresponds to the s-maxage cache-control directive and it explicitly applies to proxy servers and CDNs. The proxy max age property overrides the max-age directive and expires the header field when present.
Sliding expiration  Indicates whether the expiration time is reset on every request.
Item max size to be cached 

Indicates the maximum size in KB to be cached. The items that exceed this limit are not cached.

NOTE: This setting only affects the cache profiles for media libraries.

We recommend that you turn off the library server caching for media libraries using the file system blob

Set as default profile for...  Select whether you want to set this cache profile as default for pages and the different types of media content.

Configure cache headers for page and media cache profiles

To configure cache headers, navigate to Administration » Settings » Advanced » System » Output Cache Settings.

  1. Navigate to Page Cache Profiles or Media Cache Profiles and choose a profile.
  2. Open the Parameters page and click Create new.
  3. In the Key field enter the name of the cache header,for example varyByHost.
  4. In the Value field enter the desired value. The value indicates whether the cache header is enabled or not, thus the supported values can be true or false.

    NOTE: For the media content cache header, you need to enter a numeric value instead of boolean, as you are setting size in KB.

The following table describes the built-in cache headers for pages and media content. Depending on whether you are configuring the profile for pages or media content, you have different set of built-in cache headers.

  Cache header  Description
Pages
 

 

varyByHost  Indicates whether the cache varies by host header. Applies to the Response.Cache.VaryByHeaders<"host"> ASP.NET property.  
varyByParams

 Controls whether the cache varies by query string parameters. By default, output cache does not vary by query string parameters - Sitefinity CMS serves the same cached version of the page regardless of the query string in the URL. If you are using query string parameters, for example in your custom widgets, you can set the following options in the Value field:

  • * - a value of * instructs Sitefinity CMS to vary by any page query string parameters (create a different cached version for each query string value)
  • comma separated list of query string parameter names (e.g. 'color, size, price') - you can provide a list of query string parameter names for which Sitefinity CMS should create separate cache versions. You can also register your query string parameters in your code, which will result in them automatically entering this list runtime. For more information see Configure cache variation by query string.

varyByUserAgent

 

Indicates whether the cache varies by user agent (browser) header. Applies to the Response.Cache.VaryByHeaders.UserAgent ASP.NET property.

varyByCustom

 
Gets a custom key string that allows to specify how the output cache varies by specific context information. You can later use the key in the global application class by overriding the GetVaryByCustomString method and specifying the behavior of the output cache for the custom string. 

setNoStore

 

Sets the Cache-Control: no-store HTTP header.

setRevalidation

 

Sets the Cache-Control HTTP header to either the must-revalidate or the proxy-revalidate directives based on the supplied enumeration value.

setOmitVaryStar

 

Specifies whether the response should contain the vary:* header when varying by parameters.

Media content  maxSize  Indicates maximum size in KB of item to be cached. The items that exceed this limit are not cached.

NOTE: You can set this property either in the Advanced settings section, or when defining the cache profiles for media content in the Global settings » Cache profiles section.

You can also add a new cache header with its own logic. For more information see For developers: Add custom cache headers.  

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?