问题
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:
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.
来源:https://stackoverflow.com/questions/10514052/sitecore-caching-by-custom-param-in-code-behind