
昨晚上听了《深入挖掘ASP.NET 2.0系列》的第4讲《数据库的缓存管理与网站页面的缓存管理》。受益匪浅啊。一切只弄过页面的缓存,数据库的缓存管理还真没试过。今天找机会把Demo测试了一下,效果还不错。下面是config文件里的配置:
1
<caching>
2
<sqlCacheDependency enabled = "true" pollTime = "1000" >
3
<databases>
4
<add name="lxqq"
5
connectionStringName="lxqqConnectionString"
6
pollTime = "1000"
7
/>
8
</databases>
9
</sqlCacheDependency>
10
</caching>
把config文件配置好后,你只需要在页面上添加这么一条:<%@ OutputCache Duration="3600" SqlDependency="lxqq:Module_News" VaryByParam="none" %>就OK了!!
2

3

4

5

6

7

8

9

10

大家如果有兴趣的话,建议去下载微软的WebCast听一下,苏鹏老师讲的挺不错的!![下载]