Wednesday, 5 October 2011

ASP.NET Caching Overview

An application can often increase performance by storing data in memory that is accessed frequently and that requires significant processing time to create. For example, if your application processes large amounts of data using complex logic and then returns the data as a report accessed frequently by users, it is efficient to avoid re-creating the report every time that a user requests it. Similarly, if your application includes a page that processes complex data but that is updated only infrequently, it is inefficient for the server to re-create that page on every request.

To help you increase application performance in these situations, ASP.NET provides caching using two basic caching mechanisms. The first is application caching, which allows you to cache data you generate, such as a DataSet object or a custom report business object. The second is page output caching, which saves the output of page processing and reuses the output instead of re-processing the page when a user requests the page again.

Application Cache

The application cache provides a programmatic way for you to store arbitrary data in memory using key/value pairs. Using the application cache is like using application state. However, unlike application state, the data in the application cache is volatile. This means it is not stored in memory for the life of the application. The advantage of using the application cache is that ASP.NET manages the cache and removes items when they expire or become invalidated, or when memory runs low. You can also configure application caching to notify your application when an item is removed. For more information, see Caching Application Data.

Page Output Cache

A typical kind of caching for server applications is output caching. Output caching enables you to store rendered HTML. The stored HTML is served in response to subsequent requests for the same page. You can use output caching to cache a whole Web page or just the output of an ASP.NET control. Output caching enables you to do the following:
  • Configure ASP.NET to cache a particular output cache entry for a specific period.
  • Cache a different version of the content based on the browser type or user-language preferences of the clients visiting your application.
  • Cache a mobile version of a page that differs from a version that is optimized for a desktop browser.
  • Configure ASP.NET to evict a cache entries based on an external event.
Output caching is extensible. You can use a custom output cache provider that can store data on any data storage device.

The page output cache stores the contents of a processed ASP.NET page in memory. This lets ASP.NET send a page response to a client without going through the page processing life cycle again. Page output caching is especially useful for pages that do not change often but that require significant processing to create. For example, if you are creating a high-traffic Web page to display data that is not frequently updated, page output caching can dramatically increase the performance of that page. Page caching can be configured individually for each page, or you can create cache profiles in the Web.config file, which allow you to define caching settings once and then use those settings with multiple pages.

Page output caching provides two models for page caching: full-page caching and partial-page caching. Full-page caching persists the complete contents of a page and uses the cached page content to fulfill client requests. Partial-page caching persists specified portions of a page and lets other portions of the page be created dynamically.


At 29 December 2015 at 02:11 , Blogger wdmtest said...

Creating Asynchronous, Transactional, Cache-Friendly Web Services
Scalability Challenges with Web Services
Asynchronous Web Methods
Modifying the ASP.NET AJAX Framework to Handle Web Service Calls
Developing Your Own Web Service Handler
Making an Asynchronous and Cache-Friendly Proxy
Scaling and Securing the Content Proxy

At 20 May 2016 at 03:05 , Blogger Ananth M said...

It is really very excellent,i find all articles was amazing.awesome way to get exert tips from everyone,
not only i like that post all peoples like that post,because of all given information was wonderful and it's very helpful for me.
Dotnet training in Chennai

At 20 May 2016 at 03:33 , Blogger deeksha said...

your blog is really good thanks for sharing those information it is really helpful and useful too.

dotnet Training in Chennai

At 24 October 2016 at 06:31 , Blogger Padhma said...

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate you confidence and trust in us.
Home Spa Services in Mumbai

At 3 February 2017 at 04:54 , Blogger Vignesh PV said...

Wonderful blog.. Thanks for sharing informative blog.. its very useful to me..
ios Training in Chennai

At 9 February 2017 at 23:52 , Blogger Shalini said...

Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
Digital Marketing Company in India
Seo Company in India

At 15 June 2017 at 00:11 , Blogger john stany said...

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.

Android App Development Company

At 4 July 2017 at 22:52 , Blogger john stany said...

You have provided an nice article, Thank you very much for this one. And i hope this will be useful for many people.. and i am waiting for your next post keep on updating these kinds of knowledgeable things...
iOS App Development Company
iOS App Development Company

At 12 July 2017 at 07:13 , Blogger louis philip said...

I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

Fitness SMS
Fitness Text
Salon SMS
Salon Text
Investor Relation SMS
Investor Relation Text

At 4 October 2017 at 23:30 , Blogger louis philip said...

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
Sms marketing
Text message marketing
Fitness SMS

At 27 January 2018 at 03:57 , Blogger Govind Raj said...

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
PSD to Wordpress
wordpress website development


Post a Comment

Subscribe to Post Comments [Atom]

Links to this post:

Create a Link

<< Home