Index-dependent HTML caching

Version: 10.4

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:

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:

RequestResponse
<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>

Do you have some feedback for us?

If you have suggestions for improving this article,