您的位置:首页 > 编程语言 > ASP

asp.net 页面输出缓存

2018-10-12 13:57 323 查看
主要用于不经常更新和修改,而在第一次编译是时要经过大量处理的数据。页面输出缓存是缓存的整个页面
使用很简单<%@ OutPutCache Duration="60" VaryByParam="none"%>
Duration:缓存时间
VaryByParam:通过参数来更新缓存的内容
还有其他的一些属性
CacheProfile:调用WebConfig中的缓存时间
例如:WebCofig中

<system.web>
<outputCacheSetting>
<outputCacheProfiles>
<add name="cacheTest" duration="50"/>
<outputCacheProfiles>
</outputCahceSetting>
</system.web>

在页面中声明
<%@ OutputCache CacheProfile="cacheTest" VaryByParam="none"%>
VaryByControl:通过控件来改变缓存
<%@OutputCache Duration="60" VaryByParam="none" VaryByControl="Button1"%>

您可能感兴趣的文章:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: