Sitecore: Caching by custom param in code behind?

2019-07-21 06:05发布

We are looking to enable caching in Sitecore 6 on a specific page, however, this page has an image set based on a random value - and as such, we actually need to cache each individually rendered page so that we can keep this "random" image.

Any suggestions? I figured that we would need to use sublayout params, but can not see how I can set this in the code behind to influence the caching behaviour.

Any way of directly manipulating the cache entry?

Regards,

Andy

1条回答
Deceive 欺骗
2楼-- · 2019-07-21 06:49

Create an outer sublayout defined in Sitecore, e.g. MyComponent. In the code for that, statically bind an inner sublayout, eg. MyComponentInner and in the C# of the former, set the VaryByParms value to be a random number.

查看更多
登录 后发表回答