【发布时间】:2014-11-30 13:55:11
【问题描述】:
我有方法:
[HttpGet]
[OutputCache(Duration = 300, Location = OutputCacheLocation.Client)]
public JsonResult TopNotification(Guid? portalIdentifier, string url)
{
var notificationMessages = new List<NotificationModel>();
//Filling notification messages
return Json(notificationMessages, JsonRequestBehavior.AllowGet);
}
从基础布局调用:@Html.Partial("TopNotification")
如果在缓存持续时间结束之前发生某些操作,我需要重写我的 notificationMessages。 当用户访问某个 URL 时,我需要重新填写消息。
【问题讨论】:
-
stackoverflow.com/questions/16194140/… ?但是:如果您要在客户端缓存 :没有机会。你不能让客户忘记,除非他们也回到服务器检查 304
标签: c# asp.net-mvc-4 outputcache