asp.net MVC,
if (User.Identity.IsAuthenticated) {
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddMinutes(-1));
Response.Cache.SetNoStore();
Response.Cache.SetNoServerCaching();
}
else {
Response.Cache.VaryByParams["id"] = true; // this is a details page
Response.Cache.SetVaryByCustom("username"); // see global.asax.cs GetVaryByCustomString()
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
Response.Cache.SetCacheability(HttpCacheability.Server);
Response.Cache.SetValidUntilExpires(true);
}
, ( ), ( , if ).
- , . GetVaryByCustomString "", , , .