我有一个Sitecore 7控制器渲染。我需要通过自定义方法来改变OutputCache。我可以在Sitecore 7控制器渲染中使用VaryByCustom吗?
渲染目前在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属性......就好像它实际上只是做了默认“ Cachhable“,”VaryByData“,”VaryByParm“行为tecore。
任何线索?