Steps for using SQLServer high-speed cache dependency.
Steps for using SQL Server high-speed cache dependency.
1. Enable the database to support SQL high-speed cache dependencies.
2. Enable the table to support SQL high-speed cache dependencies.
3. The web. config file of the ASP. NET application contains the SQL connection string.
4. Use SQL high-speed cache dependency as follows:
1) create a SqlCacheDependency object by programming in the code.
2) Add the SqlCacheDependency attribute to the OutputCache command.
3) Use Response. AddCacheDependency to add a SqlCacheDependency instance to the Response object.
Allows the database to enable SQL high-speed cache dependency.
Disable the database from enabling SQL high-speed cache dependencies.
Allows the table to enable SQL high-speed cache dependency. The-t option is required.
Disable the SQL high-speed cache dependency on tables. The-t option is required.
Supports or disables SQL high-speed cache-dependent table names. -Et or-dt is required.
Lists All Tables with SQL high-speed cache dependency enabled.Use the high-speed cache disabling function (the following settings can also be performed in 2005)
Enable high-speed cache dependency for tables.
Example:
Note:
Note:
ConnectionString = "Data Source =.; Initial Catalog = Northwind; User ID = sa; Password = sa"
ProviderName = "System. Data. SqlClient"/>
: Provides an identifier for the SQL Server database.
: Specifies the connection name.
: Specifies the time interval for SQL Server to take turns detection. The default value is 5 seconds or 500 milliseconds. This attribute is not required for the SQL 2005 notification function.
After the web. config file is correctly configured, you can disable the SQL Server cache function on the page. ASP. NET will put the SQL Server request on a completely different thread in the AspNet_SqlCacheTablesForChangeNotification table to see if the changeId number is increasing. If the number changes, ASP. NET will know that the underlying SQL Server table has been modified, and a new result set should be retrieved. It determines whether an SQL Server call should be performed. The request to the AspNet_SqlCacheTablesForChangeNotification table will get a result. After the SQL Server high-speed cache disabling function is enabled, the execution will be very fast.
%>