---
title: "Index-dependent HTML caching"
slug: "index-dependent-html-caching"
abstract: "Describes the indexing aspects of HTML caching."
---
# Index-dependent 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](https://doc.sitecore.com/api/markdown-image/xp/en/developers/102/platform-administration-and-architecture/images/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:

```xml
<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>

```