C # ASP. NET system Cache full parsing

Source: Internet
Author: User

Original: http://blog.csdn.net/wyxhd2008/article/details/8076105

Catalogue (?) [-]

  1. full parsing of the system cache 1 Overview of System caching
  2. full parsing of the system cache 2 page Output Caching
  3. full parsing of the system cache 3 page Local Cache
  4. full parsing of the system cache 5 File Cache Dependency
  5. full parsing of the system cache 6 Database Cache Dependency
  6. full parsing of the system cache 7 third-party distributed caching Solutions Memcached and the Cacheman

system cache what What good is it? for a simple example, you want to query some data on a Web page that doesn't change in real time, or that the time of the change is limited. For example, query some historical data. Then every user checks the data is the same. If you do not set the cache, asp.net n Times, This adds to the unnecessary overhead. As a result, it is possible to use the cache in a way that is always faster to return data from memory than to go to the database, thus providing the performance of the application greatly. After all, the memory is very cheap now, and space for time efficiency should be very cost-effective. Especially for long-time, need to set up a network link database query operations. Caching is a very important part of a large web site design. Database-driven web application, if you need to improve its performance, The best approach is to use the caching feature.

System Cache full resolution 1: Overview of the system cache ?

1????? classification of the cache ???? from a distribution perspective, we can summarize the client cache and server-side caching. :


client-Side Caching -- We all have an intuitive impression of this. For example, if you go to a new website, it may take a while for the first time to load the entire page. And then go again, time will be greatly shortened, the reason is that the client cache. Now the browser is more intelligent, it will be on the client machine's hard disk to retain a lot of static files, such as various gif,jpeg files and so on. When you go later, it will try to use the files in the local cache. Only the server-side files are updated, or the files in the cache expire, it will be downloaded again from the server side. Most of the time, IE did this for us. ?

server-Side Caching --? some things can not or should not be in the client cache, then we have to find a way on the server side. Server-side caching in terms of nature, can be divided into two.

  1. static file caching

    many pages are static and rarely changed, so this file is most suitable for static caching. Now theIIS 6.0This part is stored directly in theKernelin memory, by theHTTP. SYSDirect Management. Because it is inKernel Space, so it has a very high performance. If the user's request is inside the cache, thenHTTP. SYSsend content directly toNetworkdrivergo up, don't need to be like before fromIISof theUser Spaceof MemoryCopyto theKerneland then send it toTCP/IP stackon. Kernellevel Cacheis almost now high performanceWeb Serveran essential feature of the.

  2. Dynamic caching

    Dynamic caching is more difficult. Because you should always be aware of the problem when caching, that is, the content of the cache is outdated. Because the content is outdated, there can be serious consequences. For example, websites that buy and sell stocks online. The price you offer to others is out of date, and the other person must cut you off. How caching discovers whether or not you are outdated is a very complex issue.

??? in the ASP , there are several methods for the common dynamic caches: :

? ?? Traditional caching methods

? ?? page Output cache.

? ?? page Local cache.

? ?? Use . NET provided by System.Web.Caching Cache.

? ?? cache dependency.

2? Traditional caching methods

For example, to put reusable things Application or Session to save the.

? session["Style"] = val;
? application["Count"] = 0;

?

?

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.