Html caches in Sitecore are cleared on publish however there is a HtmlCacheClearAgent which you can run to periodically clear the caches as well. This agent is disabled by default. When is it appropriate/advisable to enable the HtmlCacheClearAgent?

3 Answers 3


The cache is typically cleared when publishing, which would happen frequent enough for you to not enable this agent.

Imagine a case where you don't want the cache to be cleared, perhaps due to the fact there is a ton of content getting published and you don't want it to refresh every single time an item changes. You could then use this to refresh it once a night to limit the impact to the users.

  • Great answer! This is the most common use-case that I've seen. Jan 4, 2017 at 21:56

I have seen uses for the HtmlCacheClearAgent when Sitecore is serving up a lot of 'unpublished' content such as data from an external database or API. There may be changes in that external source that need to be rendered and since no Sitecore content was changed there may be no publishing actions occurring.

In this scenario, you could use an HtmlCacheClearAgent to ensure that the data displayed is at a specific interval of freshness.

However, this should only be used if a large portion of the system is being driven this way. Otherwise, you would be better off looking at something at the rendering level (perhaps disabling cache on the rendering) to make sure the data is fresh.

  • I have seen the technique you describe implemented on sites where the client did not want to pay to develop custom caching variance support. Great answer! Jan 4, 2017 at 21:58

HTML cache get cleared automatically when publishing get completed. HtmlCacheClearAgent is disabled by default but when the cached data is large and you want to clear it on specific time to maintain the performance, you need to enable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.