Caching overviewcaching is a technique this is widely used into computing to increase performance by keeping frequently ssed or expensive data in memory. In the context of a WEB application, caching are used to hold onto pages or data across HTTP requests and reuse them t the expense of recreating them.
ASP.net has two kinds of caching that can is utilized by WEB applications.
Caching The dynamic response generated by a request is known as Output Caching.
The caching of arbitrary objects programmatically is known as Data caching. To support this, ASP.net provides a full featured Cache engine which allows programmers to easily hold the data onto across Uests.
Output caching is useful the contents of a entire page can be cached. On a heavily accessed site, caching frequently accessed pages for even a minute at a time can result in substantial throug Hput gains. While a page was cached by the output cache, subsequent requests for this page are served from the output page without exec Uting the code that created it.
Sometimes it ' s not practical to cache a entire page--perhaps portions of the page must is created or customized for each Request. In this case, it's oftentimes worthwhile to identify objects or data that are expensive to construct that are for Caching. Once these items are identified, they can is created Once and then cached for some.
Choosing the time to cache a item can make for an interesting decision. For some items, the data might was refreshed at regular intervals or the data are valid for a certain to amount of time. In this case, the cache item can be given a expiration policy that would cause them to be removed from the cache when they ' Re expired. Code that accesses the cache item simply checks for the absence of the item, and recreates it if necessary.
The asp.net cache supports file and cache key dependencies, allowing developers to make a cache item dependent on a Exter NAL file or another cache item. This technique can is used to invalidate the items when their underlying data source changes.
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