Sitecore Experience Platform

Index-dependent HTML caching

Abstract

Describes the indexing aspects of HTML caching.

Some index update strategies are designed to be invoked either when publishing completes or after a specific interval of time has passed. If your Sitecore instance uses HTML caching for renderings, controls, or sublayouts that contain code, and this code depends on an index, a race condition between HTML cache clearing and index update operations can occur.

You can solve this issue by selecting Cacheable and Clear on Index Update for these renderings, controls, and sublayouts:

637DB7FEDAE9475788D14755F9A1C153.png

You can do this on the rendering definition item or on the layout details for a specific content item, in a similar way to how you can set the Vary by settings.

When you select Clear on Index Update, Sitecore clears the HTML cache of renderings when the index is updated, using the IndexDependentCacheManager component. The execution of this component is triggered from the indexing:end and indexing:end:remote events in the Sitecore.ContentSearch.config file:

<event name="indexing:end">
    <handler type="Sitecore.ContentSearch.Maintenance.
        IndexDependentHtmlCacheManager, Sitecore.ContentSearch" method="Clear" />
</event>
<event name="indexing:end:remote">
    <handler type="Sitecore.ContentSearch.Maintenance.
        IndexDependentHtmlCacheManager, Sitecore.ContentSearch" method="Clear" />
</event>