ASP. NET cache resolution)

Source: Internet
Author: User

ASP. NET cache resolutionArticleIndex

    • ASP. NET cache Resolution 1: cache Overview
    • ASP. NET cache Resolution 2: page output Cache
    • ASP. NET cache resolution 3: Partial page Cache
    • ASP. NET cache resolution 4: Application Data Cache
    • ASP. NET cache resolution 5: File Cache dependency
    • ASP. NET cache resolution 6: database cache dependency
    • ASP. NET cache resolution 7: third-party distributed cache solutions memcached and cacheman

Sometimes I always hear netizens say that the website is running slowly, but I don't know how well it is. Sometimes I see some friends who write website functions very well, but the access performance is extremely poor. Without the consciousness of "diligence and thrift", it will inevitably lead to "extravagance and waste ". How to deal with this situation, make full use of the system cache is the first way.

What are the benefits of system cache? For example, if you want to query some data on a webpage, the data does not change in real time, or the change may take a long time. For example, query some historical data. The data that each user queries is the same. If no cache is set,ASP. NETThe query will be repeated based on each user's request.NThis increases unnecessary overhead. Therefore, if possible, use the cache as much as possible. The data returned from the memory is always faster than the data retrieved from the database. Therefore, applications can be greatly provided.ProgramPerformance. After all, the memory is very cheap, and it is very cost-effective to exchange space for time efficiency. Especially for database queries that take a long time and require network connections. 

Caching is an important part of large-scale website design. Database-drivenWebThe best way to improve the performance of an application is to use the cache function.

  Cache category

In terms of distribution, we can summarize the Client Cache and server cache.

Client Cache-- This is an intuitive impression. For example, when you go to a new website, it may take a while for the first time to load the entire page. In the future, the time will be greatly shortened, because the client cache. Today, browsers are intelligent, and many static files will be retained on the hard disk of the customer's machine, such as variousGIF, JPEGFiles. When you try again later, it tries its best to use the files in the local cache. Only when files on the server have been updated or the files in the cache have expired will they be downloaded from the server again. Most of the timeIEI did this for us.

Server Cache-- Some things cannot be cached on the client, so we have to find a solution on the server. Server-side cache can be divided into two types in terms of nature.

(1)Static File Cache

Many pages are static and rarely changed. Therefore, such files are most suitable for static cache. The currentIn IIS 6.0This part of content is directly stored inKernelMemoryHTTP. sysDirect management. Because it is inKernel space, So its performance is very high. If your request is in the cacheHTTP. sysDirectly send contentNetwork DriverUp, not fromIISOfUser spaceMemoryCopyToKernelAnd then send itTCP/IP stack.Kernel level cacheAlmost current High PerformanceWeb Server.

(2)Dynamic Cache

Dynamic Caching is more difficult. Because you should always pay attention to the problem when caching, that is, whether the cached content is out of date. If the content is outdated, it may cause serious consequences. Such as online stock trading websites. The price you offer to others is out of date, and the people will not cut you down. It is very complicated to find out whether the cache is outdated.

InASP. NETCommon Dynamic Caching methods are as follows::

ØTraditional cache Methods

ØPage output cache.

ØPartial page cache.

ØExploitation. NetProvidedSystem. Web. cachingCache.

ØCache dependency.

Traditional cache Methods

For example, put reusable items inApplicationOrSessionTo save.

 
Session ["style"] = val; application ["count"] = 0;
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.