HTML Cache

The HTML cache is an output cache that caches renderings, not whole pages. You use the HTML cache to improve the performance and response time of the websites.

To enable the HTML output cache:

  1. Patch the site specification of predefined sites in the sites node of the \App_Config\Sitecore.config\App_Config\Sitecore\CMS.Core\Sitecore.Sites.config file and set the cacheHtml property of sites to true to enable the HTML output cache for that site.
  2. Add caching options to the renderings Sitecore caches output for. You can do this in two ways:
      • Locally by specifying the options every time you use a rendering. To do this, open the item in the Content Editor, and on the Presentation tab, click Details, and then click the rendering you want to set options for.
      • Globally by specifying the options in the definition item of the rendering. This is then the default setting for all uses of this rendering. To do this, open the rendering definition item in the sitecore/Layout/Renderings part of the content tree, and navigate to the options in the Caching section.
    1. In a standard Sitecore installation, Sitecore clears the cache on each publish. This is specified for the default website. If you add websites, you must patch the Sitecore.config setting like this:
      • Add the website to the publish:end event handler:
        <event name="publish:end">
          <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel"                method="ClearCache">
            <sites hint="list">
              <site>website</site> <!-- the default site -->
              <site>yoursite</site> <!-- your site(s) -->
            </sites>
          </handler>
          <handler type="Sitecore.Publishing.RenderingParametersCacheClearer, Sitecore.Kernel" method="ClearCache" />
        </event>

    Sitecore clears caches for all sites you configure with the value of the cacheHtml property as true. The publish:end event handler is configured like this in a standard installation:

       <event name="publish:end">
          <handler type="Sitecore.Publishing.SmartHtmlCacheClearer, Sitecore.Kernel" method="ClearCache" resolve="true" />
          ...
        </event>

    If you do not want the cache for a site to be cleared when you publish you can add the preventHtmlCacheClear attribute to the site definition like this:

    <site name="custom_website" cacheHtml="true" preventHtmlCacheClear="true" … />



    Comments

    Popular posts from this blog

    Email Experience Manager (EXM)

    Federated Experience Manager (FXM)