SqlDataSource control but also to EnableCaching property set to true, this would automatically buffered by SqlDataSource SelectCommand retrieves data. This property allows you to specify CacheDuration (in seconds) to refresh the data from the database should be buffered before long. By default, SqlDataSource will use an absolute expiration policy to cache data; This means that data every property in the specified number of seconds CacheDuration refresh.
You can also selectively configure the SqlDataSource to use a "sliding" expiration policy. Through this strategy, as long as the data continue to be accessed, it will not be deleted. When you have a large number of items need to be buffered, use sliding expiration policy is very useful because the strategy enables you to keep in memory only to be the most frequently accessed items. In the above example, by, respectively, and CacheDuration EnableCaching property set to True, and 10, your SQL query result buffer time period of 10 seconds.
Third, the SqlDataSource control in the SQL cache invalid
So far, you have to see how the SqlDataSource control based on the CacheDuration property values set the duration of the cache is invalid. In this section, I will explain the basis for SQL Server data in the table to implement a caching mechanism for the step is invalid. This caching mechanism is ineffective, a new ASP.NET 2.0 features, then a buffer page or a data source control can be bound to a SQL Server database in a particular table. Once you realize the relevance of this initialization operation, then change the table of contents will lead to a buffer object automatically invalid.
銆怰ecommendations multiple pages when you need to use the same database data, you should consider using the SQL data source control mechanism for caching invalid.
In fact, based on SQL Server's cache is invalid mechanism applies to SQL Server 7.0 and above; However, SQL Server 7.0 and 2000 only supports table-level caching mechanism is invalid. This means that any timetable for when the data changes, the buffer entry is automatically invalid. SQL Server 2005 also provides a mechanism for line-level cache is invalid, it can be a more detailed level of control buffer up data.
In SQL Server 7 and SQL Server 2000, the table-level cache is invalid is by using a query system (a particular ASP.NET processes) support. The process queries the database every time a specific ("pull" model) to monitor what has been checked since the last time the table changes. Although this model can pull the case for most, but it is not a very effective method. Fortunately, this situation in SQL Server 2005, has been greatly enhanced - at any time to modify a particular data line, in fact, by the SQL Server is responsible for notification (push model) ASP.NET. SQL Server 2005 by using a service called informed the author (Notification Delivery Services, which uses port 80) is characterized by realization of this function, the service can directly interact with IIS6.0 the HTTP.SYS to inform the Web server updates a particular row . Next, I will explain how the SQL Server 7 and 2000 versions of configuration buffer.
You can use SQL Server 7 or SQL Server 2000 build cache dependency, you need to complete the following steps:
鈼?Configure SQL Server to support SQL cache is invalid. It only takes a one-time set up you want to monitor the SQL Server database table or database can be.
鈼?the necessary configuration information to the web.config file.
Next, let us analyze in detail the steps above. First, we look at the SQL Server configuration issue.
Fourth, configure SQL Server to support SQL cache invalid
You can be achieved in the following two SQL Server 2000 configured to support SQL cache is invalid:
1. Using aspnet_regsql tools;
2. Use SqlCacheDependencyAdmin class EnableTableForNotifications method.
In this paper, we consider only the first method. Above aspnet_regsql tool for creating another table AspNet_SqlCacheTablesForChangeNotification, used to track changes in the database table of all the changes being monitored; it also creates a set of triggers and stored procedures to support this capacity. In order to run aspnet_regsql tool, simply open the Visual Studio command prompt, then enter a command similar to the following:
D:> aspnet_regsql-S localhost-U sa-P thiru-d Pubs-ed
Operating normally, it should show the following:
Enabling the database for SQL cache dependency.
Finished.
D:>
The command to Pubs database support SQL cache invalid function. Of which:
鈼?S-server name
鈼?U-used to connect to the SQL Server user ID
鈼?P-used to connect to SQL Server's user password
鈼?d-database name
鈼?ed-support database caching with SQL Server trigger invalid function
Once in the database to complete the above action level, then you need to start at a single table-level caching invalid function. Please refer to the specific realization of the following commands:
D:> aspnet_regsql-S localhost-U sa-P thiru-t authors-d Pubs-et
Operating normally, it should show the following:
Enabling the table for SQL cache dependency.
Finished.
D:>
In the above command:
鈼?t-designated name of the table
鈼?et-support for the SQL Server table has a trigger function of the cache is invalid
The above command shows how the authors table in the Pubs database, start SQL cache invalid support. Once you have configured to send notification authors table, then any time the data in the table changes, it will notify the ASP.NET so that in the corresponding cache entry is invalid.
相关链接:
Storage Games Kids
ZEBEXZ-1071BT Hot promotions
Find driving force behind IPv6
VOB to Flash
Brief Games Board
who wants used cell phones
Nokia's enemies
COMPARE Accounting And Finance
dPAL apartment door MACHINE
MicroStrategy To support Apple? IPhone?
MPG TO Flash
AVI To MPEG4
Your New Year with Photojoy Xiu Zhao
Hot Themes And Wallpaper
C2C staged "Three Kingdoms"
No comments:
Post a Comment