Skip to main content

Implementing output caching for the Layout Service


An overview of output caching configuration for the Layout Service.

When the ASP.NET Core or JavaScript SDKs invoke the Layout Service, Sitecore output caching (also known as HTML caching) does not store rendered HTML, as it does with Sitecore MVC.

In Sitecore MVC, output caching saves the HTML that is returned by your components for renderings that have caching enabled. On subsequent requests, it returns the cached HTML without executing the renderings, until publishing clears the cache.

When you configure output caching on JSON renderings with the Layout Service, instead, it saves the JSON of the component’s layout in the output cache. On subsequent requests, rather than needing to reserialize data source items or rerun a custom rendering contents resolver, the Layout Service returns the cached JSON, until publishing clears the cache.

You can get significant performance gains from configuring output caching for Layout Service renderings, even though it is your rendering host that is processing that JSON to HTML.

You can follow existing guidance for Sitecore MVC HTML caching when configuring the cacheability and Vary By parameters on your JSON renderings.

Configuring the cacheability and Vary By parameters in JSON renderings in the Control Properties dialog box