我们有两个带OutputCaching的控制器,一个工作正常,第二个没有缓存......
工作控制器示例:
[OutputCache(Duration = 1, VaryByParam = "idc,key")]
public dynamic Get(string idc, string key)
{
string coins = idc;
string size = key;
try
{
Models.api.dicebets bets = new Models.api.dicebets();
return bets.LastBets(coins, size);
}
catch
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Invalid request");
}
}
具有非工作OutpuCache的类似控制器的示例:
[OutputCache(Duration = 3)]
public dynamic Get()
{
try
{
Models.api.dicebets bets = new Models.api.dicebets();
return bets.HighRolls();
}
catch
{
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Invalid request");
}
}
我已经尝试过所有OutputCache设置的组合,如:
[OutputCache(Duration = 3, VaryByParam = "None")]
[OutputCache(Duration = 3, VaryByParam = "*")]
[OutputCache(Duration = 3, VaryByParam = "")]
似乎没有用......