电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

页面输出缓存


发布日期:2024/1/25
 

最简单的缓存机制把整个Aspx页面保存在服务器端内存中用户请求页面时直接从服务器端内存中提取数数据不在经历页面的生命周期主要用于不经常更新和修改而在第一次编译是时要经过大量处理的数据页面输出缓存是缓存的整个页面

使用很简单<%@ OutPutCache Duration= VaryByParam=none%>

Duration:缓存时间

VaryByParam:通过参数来更新缓存的内容

还有其他的一些属性

CacheProfile:调用WebConfig中的缓存时间

例如WebCofig中

<systemweb>

<outputCacheSetting>

<outputCacheProfiles>

<add name=cacheTest duration=/>

<outputCacheProfiles>

</outputCahceSetting>

</systemweb>

在页面中声明

<%@ OutputCache CacheProfile=cacheTest VaryByParam=none%>

VaryByControl:通过控件来改变缓存

<%@OutputCache Duration= VaryByParam=none VaryByControl=Button%>

上一篇:XSL中几个封装的函数

下一篇:处理QueryString函数汉字参数传递错误