ASP. NET cache _ new functions in ASP. NET Cache

Source: Internet
Author: User
Tags configuration settings

ASP. NET 2.0 retains all the caching functions of ASP. NET 1.1. It also adds new functions and enhances existing functions. The new features include cache configuration files, custom cache dependencies, SQL cache dependencies, and creating dynamic content on the cache page (with cache replacement ). Enhanced functions include a more powerful partial-page (Control) cache model, enhanced cache configuration, and improved output of cache commands.
1. New cache Function
Cache configuration file
The cache configuration file allows you to create cache settings in the web. config file of the application, and then reference these settings on a single page. This allows you to apply cache settings to multiple pages at the same time. For example, you can define a cache configuration file named dailyupdate, which sets the page cache duration to one day. You can then configure each page to use dailyupdate to cache the configuration file, and the cache duration of these pages is one day. If you change the dailyupdate cache configuration file to no cache, the pages will be stopped.
Custom cache Dependencies
In ASP. NET 2.0, you can create your own custom cache dependencies based on specific application conditions. To create custom cache dependencies, create a class inherited from cachedependency and implement your own dependency methods in the Custom class. For example, you can create a dependency to poll data in the Web Service. When data changes, you can invalidate the cache data.
Sqlcachedependency
ASP. NET 2.0 introduces the sqlcachedependency class, which enables you to configure an item in the cache to have dependencies on tables or rows in the Microsoft SQL Server database. When changes occur in a table or a specific row, the cache items with dependencies become invalid and removed from the cache. ASP. NET 2.0 enables you to set table dependencies in SQL Server 7.0, SQL Server 2000, and SQL Server 2005. When you use SQL Server 2005, you can also set the dependencies for specific records.
Cache replacement
ASP. NET 2.0 now supports cache replacement, allowing you to configure a part of the page as non-cache. Therefore, even if the page is cached, part of the page will be reprocessed when you request the page again. For example, you can use most static content (but not the content that shows the user name in the label Control) to create a cache page. If you do not use the cache, the user name remains unchanged in all requests. If you replace it with a cache, you can mark the page as cacheable and place the label control in another control marked as non-cacheable. The user name is refreshed every time this page is requested.
2. cache Enhancement
Control Cache
In ASP. NET 1.1, configure the user control cache with parameters declared in the @ control command. In ASP. NET 2.0, you can use the cachepolicy object at runtime to configure the user control cache settings. The cachepolicy object allows you to process the user control cache in the same way as the page output cache is processed programmatically.
Cache configuration Enhancement
In addition to the cache configuration file, new cache configuration settings are introduced in ASP. NET 2.0. You can specify these settings in the web. config file of the application. These settings increase your cache control, such as memory usage and cache cleanup.
Improved output cache commands
ASP. NET 2.0 includes new @ outputcache Command Options and enhancements to existing options. New Features and enhancements enable you to declare and control the output cache function. Previously, you could only use the httpcachepolicy class to implement this type of control programmatically. For example, you can set the Duration Attribute and nostore attribute in the @ outputcache command in declarative mode.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/lovelacy/archive/2007/05/09/1601883.aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.