脚印
kvsg_yang
全部博文(16)
2011年(1)
2009年(9)
2008年(6)
Phyllis6
不惊者怀
简单爱13
davidbec
mengmeng
分类: 系统运维
2008-09-24 10:55:22
<%@ OutputCache Duration="15" VaryByParam="none" %><!--设置单个页面缓存,缓存时间为15秒--><%@ OutputCache CacheProfile="AppCache1" VaryByParam="none" %><!--设置缓存,利用web.config,里面的AppCache1 <caching> <outputCacheSettings> <outputCacheProfiles> <add name="AppCache1" enabled="true" duration="60"/> </outputCacheProfiles> </outputCacheSettings> </caching> --> <%--<%@ OutputCache Location="Server" Duration="60" VaryByParam="Color" %>--%>
使用程序进行缓存(页面缓存)
Response.Cache.SetExpires(DateTime.Now.AddSeconds(60)); Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetValidUntilExpires(true)
Cache.Insert("key", myXMLFileData, new System.Web.Caching.CacheDependency(Server.MapPath("users.xml"))); 该示例可将文件中的 xml 数据插入缓存,无需在以后请求时从文件读取。 CacheDependency 的作用是确保缓存在文件更改后立即到期,以便可以从文件中提取最新数据,重新进行缓存。如果缓存的数据来自若干个文件,还可以指定一个文件名的数组。
上一篇:asp+水印
下一篇:format的参数
登录 注册