I have a couple of controller renderings where the data loaded is from several Sitecore items including the "page" itself, and the Rendering datasource is not actually set on the Rendering. How can I cache this so that the rendering is cached differently for each page it's on despite no datasource on the rendering being set? I would think Vary By Data, but doesn't that only work if you have different datasources set on the individual renderings?
1 Answer
As long as the output is always the same on each page then you can use Vary By Data
, this will cache based on the context item if no data source is set.
Note that as per Mark's point this might not be the best way to implement a rendering as you will lose the ability to personalize the rendering through the Datasource
.