gpt4 book ai didi

caching - 如何为 Sitecore ControllerRendering 启用缓存

转载 作者:行者123 更新时间:2023-12-01 07:26:00 24 4
gpt4 key购买 nike

有没有办法为布局中静态声明的 ControllerRendering 启用 Sitecore 缓存?在 Webforms 中,您可以像这样声明渲染的缓存设置:
<sc:Sublayout ID="slMyControl" path="~/path/to/my/control.ascx" VaryByParm="true" Cachable="true" runat="server" />
但是,当我使用 Html 助手时,Controller 方法没有重载来接受缓存参数?
@Html.Sitecore().Controller("NAMESPACE", "ACTION")
我正在运行 Sitecore 7.2

最佳答案

如果你想静态绑定(bind)一个 Controller 渲染,你应该使用 Rendering() html 帮助程序上的方法。在那里您可以使用参数定义缓存:

@Html.Sitecore().Rendering("<your rendering definition item id>", new { Cacheable = true, CacheKey = "my_rendering", Cache_VaryByData = true })

参数应与子布局中使用的名称相同,带有 Cache_字首。

关于caching - 如何为 Sitecore ControllerRendering 启用缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26050994/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com