在ASP.NET MVC2中,我使用OutputCache
和VaryByParam
属性。当我有多个参数的方法时,我已经成功使用单个参数使其正常工作,但是正确的语法是什么?
[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId)
{
//I've got this one under control, since it only has one parameter
}
[OutputCache(Duration=30, VaryByParam = "customerId"]
public ActionResult Index(int customerId, int languageId)
{
//What is the correct syntax for VaryByParam now that I have a second parameter?
}
我该如何让它同时使用这两个参数进行缓存?我需要将属性添加两次吗?还是将"customerId, languageId"作为值写入?