Finding cacheable renderings in Sitecore - mitikov/KeepSitecoreSimple GitHub Wiki

Why relying on HTML cache?

You will not print an exactly same family photo whenever you want to see it, right?

Why do you force an application to do so by rendering exactly same markup for each request?

HTML cache allows reusing already produced markup for renderings thereby much speeding up request processing in high loaded solutions.

Find all cacheable renderings

Sitecore presentation concept is based on renderings that can set default caching configuration:

html_caching

Knowing that every shared field value is stored in SharedFields table, we can easily find the list of renderings that have caching configured.

Inspecting Standard Values

Default presentation is be assigned to Standard Values, thus it can also enforce cacheable settings:

standard_values

Knowing that:

  • Layout is a shared field
  • Layout has XML format

SQL query can be composed to get a list of standard values with predefined cacheable presentation:

cacheable_standard_values

Inspecting layout field for items

One directly can assign/modify presentation on items. Knowing that:

  • Items do not store the whole layout information, but only delta
  • Latest Sitecore allows storing different presentation for different versions (so-called Final layout)

We can compose one more SQL query.

Conclusions

Re-using rendered markup is crucial for getting high throughput.

Even though Sitecore offers a powerful HTML caching mechanism, people start using it only after stepping into performance issues and high response rates.