2010-11-01 36 views
0

下面的代码行会做什么。程序缓存

这将设置缓存时间。

Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); 

这是干什么的?

Response.Cache.SetCacheability(HttpCacheability.NoCache); 

这是干什么的?第一行代码集缓存然后为什么这行代码需要是真的?

Response.Cache.SetValidUntilExpires(true); 

预先感谢 迪夫亚

回答

1

Response.Cache.SetCacheability(HttpCacheability.NoCache);

“设定高速缓存 - 控制HTTP头,Cache-Control HTTP头控制文件如何被缓存在网络上“。 - http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.setcacheability(v=VS.100).aspx

-

Response.Cache.SetValidUntilExpires(true);

“指定ASP.NET缓存是否应忽略由无效缓存中的客户端发送的HTTP缓存控制头。” - http://msdn.microsoft.com/en-us/library/system.web.httpcachepolicy.setvaliduntilexpires.aspx