how to enable sql dependency output cache
2007-05-12 15:38
363 查看
how to enable sql dependency output cache :
注册 sql cache dependency
其实它的实现原理很简单, 会在系统中增加一些SP和trigger,来跟踪和记录表的变化
这个是让我想起了,Leyser Service实现本地库和DataCenter数据同步的机制,简直是如出一辙,不过我们的Leyser 系统实现得比它更早。
在web.config文件的<system.web>节点下增加:
<caching>
<sqlCacheDependency enabled="true" pollTime="2000">
<databases>
<add name="NW" connectionStringName="NorthwindConnectionString1"/>
</databases>
</sqlCacheDependency>
</caching>
<connectionStrings>
<add name="NorthwindConnectionString1" connectionString="Data Source=xa-app-xsweb/sqlexpress;Initial Catalog=Northwind;User ID=sa;Password=******" providerName="System.Data.SqlClient"/>
</connectionStrings>
NorthwindConnectionString1 是在connectionStrings中配置的数据库连接串。
在对应的aspx页面增加page directive :
<%@ OutputCache Duration="20" VaryByParam="*" SqlDependency="NW:Customers"%>
ruan your target page
注册 sql cache dependency
其实它的实现原理很简单, 会在系统中增加一些SP和trigger,来跟踪和记录表的变化
这个是让我想起了,Leyser Service实现本地库和DataCenter数据同步的机制,简直是如出一辙,不过我们的Leyser 系统实现得比它更早。
在web.config文件的<system.web>节点下增加:
<caching>
<sqlCacheDependency enabled="true" pollTime="2000">
<databases>
<add name="NW" connectionStringName="NorthwindConnectionString1"/>
</databases>
</sqlCacheDependency>
</caching>
<connectionStrings>
<add name="NorthwindConnectionString1" connectionString="Data Source=xa-app-xsweb/sqlexpress;Initial Catalog=Northwind;User ID=sa;Password=******" providerName="System.Data.SqlClient"/>
</connectionStrings>
NorthwindConnectionString1 是在connectionStrings中配置的数据库连接串。
在对应的aspx页面增加page directive :
<%@ OutputCache Duration="20" VaryByParam="*" SqlDependency="NW:Customers"%>
ruan your target page
相关文章推荐
- how to enable eclipse generate select statement 如何在eclipse里面写sql DDL语句
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to enable the IntelliSense of SQL Server 2008
- How to enable SQL Debugging.
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to enable remote connections in SQL Server 2008?
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to Enable SQL_TRACE for Another Session or in MTS Using Oradebug(文档 ID 1058210.6)
- How-to: enable spark sql in cdh version spark
- How to Enable Trace or Debug for APIs executed as SQL Script Outside of the Applications ?
- How to enable sa user account in SQL Server 2005
- How to Enable/Disable SQL Server Service Broker in script
- How to enable pretty print JSON output (Gson)
- [转载]:How to pass a list of values or array to SQL Server stored procedure?
- 【SQL】How to get First and Last day of a month – TSQL
- 使用SqlCacheDependency的一点注记(如何开启Sqlserver2000的缓存机制)
- 背后的机制 for notifications on data change: SqlNotificationRequest, SqlDependency and SqlCacheDependency
- How to enable time stamps for logs in 'dmesg' on Gaia and SecurePlatform
- 在作缓存时使用SqlCacheDependency
- asp.net mvc5中使用缓存依赖SqlCacheDependency