在MVC 3,我outputcaching一个JsonResult这样破碎后:RemoveOutputCacheItem添加查询字符串
[OutputCache(Location = OutputCacheLocation.Server, Duration = 21600, VaryByParam = "None", VaryByCustom = "tenant")]
public JsonResult NotifyTasks(int id) {
return Json(new {pending = 5}, JsonRequestBehavior.AllowGet);
}
}
的URL,以获得JSON是:
http://localhost/foo/notifytasks/1
有时我无效用的缓存页面简单
HttpResponse.RemoveOutputCacheItem("foo/notifytasks");
方法签名已更改并且RemoveOutputCacheItem不再有效。该URL现在具有查询字符串?status = Status1追加,这打破了RemoveOutputCacheItem。
[OutputCache(Location = OutputCacheLocation.Server, Duration = 21600, VaryByParam = "None", VaryByCustom = "tenant")]
public JsonResult NotifyTasks(int id, string status) {
return Json(new {pending = 5}, JsonRequestBehavior.AllowGet);
}
http://localhost/foo/notifytasks/1?status=Status1
如何获取RemoveOutputCacheItem以使用附加的查询字符串?
谢谢。我最终这样做了,事情再次正常。 – rioja 2011-04-10 15:55:30