使用Cache:
页面使用Cache,Cache的有效期为15 seconds
使用代码表示,放在Page_Load里面:
//
//Cache Manager可以控制这个页面
//
Response.Cache.SetCacheability(HttpCacheability.Public);
//
//告诉Cache Manager,页面的有效期为当前时间+15秒
//
Response.Cache.SetExpires(DateTime.Now.AddSeconds(15));
当使用@OutputCache时,Asp.Net 调用页面对象的InitOutPutCache(),将Cache转换为对应的HttpCachePolicy()。
所有对此页面的请求,都是访问Cache中的信息,直到Cache的生存周期结束。
对于页面的Cache的使用范围和存储位置:
Cache的使用范围可以使用Location属性,或者HttpResponse.Cache对象来设置。
或者
Response.Cache.SetExpires(Dat阅读全文>
发表于 @ 2006年09月22日 17:04:00|评论(loading...)|编辑