2010-11-01 74 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