In ASP. NET 2.0, many new functions and controls are added. Among them, the data cache function has greatly changed compared with asp.net 1.1. As we all know, the data cache function is very important. We can put some data that remains unchanged for a period of time in the cache, so that we do not need to read the database every time, when you need the data again next time, it can be obtained directly from the cache, greatly enhancing the efficiency.
In asp.net 1.1, the data caching function has been well implemented, but there is a small problem, that is, if the data in the database changes, the cache cannot be updated within the specified time, but must wait until the cache expires. For example, if you use page caching for product details, such as prices, on a webpage, If you modify the information in the background, the user will not immediately see the information, it takes some time to see it. In some application scenarios, if you want to update the database, the changes in the cache can take effect immediately. In asp.net 1.1, it is relatively difficult to implement, in asp.net 2.0, this function can be conveniently implemented. This article will introduce the implementation of this function with. net Framework 2.0 beta and visual web developer express beta.
First, in asp.net 2.0, new cache functions are provided for SQL server 7/2000 and the SQL server 2005 (Yukon) to be released. This section focuses on the cache function for SQL server 7/2000. This new data cache function is called SqlCacheDependency. To implement this function, follow these steps:
1. Under the. net framework 2.0 installation directory
(Ntwinmicro.netframeworkv2.0.40607), start a command line tool called aspnet_regsql.exe, such:
Aspnet_regsql-S localhost