Overview: Page Output and SQL Dependency Caching

There are a variety of caching mechanisms //缓存机制available in ASP.NET 2.0. Caching is straightforward //直接有效的,笔直的and very important for proper //适当的,正确的Web application performance//Web应用程序的性能. Every developer should learn how to use caching //缓存properly, for with it you can easily turn //转换a slow, overburdened //负载过重application into a high performance Web site//高质量的Web站点.

Here are some simple scenarios//情况,情节,剧情 to help you better understand the power of caching//缓存的力量:

Scenario 1//情况一—Page Output Caching//输出页面缓存: You have an ASPX Web page that is complex and shows information that is relatively dynamic//动态的.  Changes//改变 to the underlying//在下面的 data occur //发生fairly frequently相当频繁, but the end user //终端用户does not need to be aware of these changes every time the data is updated//被修改. For this scenario you can use Page output caching. This approach//方法.途径 caches//缓存 the page's contents, serving it from memory //内存until it expires //过期instead of serving up //端上(食物,饮料)a new page each time. You can control how long the page caching//缓存 is maintained per page//维护每个页面. A simple modification//修改 of the page directive //指令enables //使...成为可能this type of caching//这种类型的缓存.

Scenario 2//情况二—SQL Dependency//相关性,依赖性 Caching: You have data-bound //数据绑定controls that display data from SQL Server. As you probably//可能 know, round trips //矫正差错to the database are very expensive. If you could cache //缓存the underlying data displayed by one or more controls, this would boost//提高 the performance of both your database server and Web server. The catch is that you want to invalidate //使无效the cached data not //而是according to //根据,依照a timestamp //时间戳,限制时间(like the above scenario), but rather //而是when the data changes in the database. For this scenario you can use SQL dependency caching.  SQL Server 2005/SQL Express is able to notify//通知 the Web server whenever a change occurs in your database tables. This allows you to invalidate the cache//使缓存无效 immediately and automatically refresh//刷新 the control's data//控件数据<数据可以通过数据绑定控件绑定数据源实现,前面已经多次论述使用过>. VWD also ships with //过渡utilities //工具,公共设施,实用品,实用that allow you to enable your SQL 7/2000 databases to support SQL dependency caching.

SQL Server 2005/SQL Express Dependency Caching

Caching works differently in SQL Express than it does in SQL Server 7/2000. Whenever changes occur//发生 in a database table, SQL Express proactively //主动notifies//告诉 ASP.NET via//经由 IIS that the related cache//相关的缓存 must be invalidated//一定无效:

The plumbing to support caching//支持缓存的功能 is built into//内置 VWD, .NET and SQL Express, so implementation is greatly simplified compared to SQL 7/2000 dependency caching<这句有点不懂,关键是plumbing单词>.

SQL Server 7/2000 Dependency Caching

There is no notification model //没有通知模型built into SQL Server 7/2000. In other words, earlier versions of SQL Server will not proactively//自主地 notify//通知 a Web server of changes to the data. Instead, ASP.NET must monitor //监视database tables that you specify//详细说明.

The good news is that VWD ships with utilities //提供过渡工具<这句话不知怎么理解>that automatically configure a database table for dependency caching.  After running these utilities//工具, additional//额外的 cache tables are created in your database.  Additionally//另外, triggers //触发器are added to your tables to populate //构成人口,群岛the new tables.  Whenever a change occurs in your table, the data in the cache tables is also modified.  A process within ASP.NET periodically //周期性地monitors the cache table and determines whether or not a change has occurred. You can then use these change detections //侦察结果,探测结果to programmatically//在方案 invalidate the cached data.

  

 

posted on 2007-04-11 15:01  改变热爱  阅读(225)  评论(0)    收藏  举报

导航