Sitecore: Caching by custom param in code behind?

北城余情 提交于 2019-12-11 02:23:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!