【发布时间】:2014-01-22 15:13:05
【问题描述】:
我有一个 Sitecore 7 控制器渲染。我需要通过自定义方法改变 OutputCache。
渲染当前在 Sitecore 中设置为“Cachable”、“VaryByData”和“VaryByParm”。
我已经为我的操作添加了一个输出缓存属性,并设置了一个自定义的变量字符串:
[OutputCache(VaryByCustom = "ThisIsATest", Duration = 60)]
public ActionResult Index()
{
...
}
我的 Global.asax 继承自 Sitecore.Web.Application,并且我重写了 GetVaryByCustomString,如下所示:
public override string GetVaryByCustomString(HttpContext context, string custom)
{
if (custom == "ThisIsATest")
return "some custom key";
return base.GetVaryByCustomString(context, custom);
}
我从来没有看到 GetVaryByCustomString 方法触发,并且控制器的行为就好像它根本没有 OutputCache 属性...就好像它实际上只是在执行默认的“Cachable”、“VaryByData” ",来自 Sitecore 的 "VaryByParm" 行为。
有什么线索吗?
【问题讨论】:
标签: c# sitecore outputcache sitecore7