Advantages and Disadvantages of ASP.NET Caching

NET


What are the advantages and disadvantages of ASP.NET Caching?

“Caching is one of the best and often easiest ways to improve the performance of an application” (Spaanjaars ). Although accessing data is quicker, many developers too often overlook its usefulness which can be quite advantageous. For instance, caching allows a copy of your data to be stored in a location so that it can be fetched from the original source when needed instead of regenerating the data again. To make it easier, many caching solutions enable data to be stored in memory which is usually the fastest way to access data. The .NET cache does this by allowing you to store frequently accessed data in a special location within the computer’s memory. So clearly, its advantages are improved responsiveness and performance of your application.

Although caching greatly improves your application, there are some common pitfalls with caching data. Sometimes when working with caching you will find that you will end up with stale or out of date data. This means that the data you are working with no longer matches the source from which it derived. To avoid this, cache invalidation needs to occur. Cache invalidation removes an item from the cache to allow re-creation during the next request.

Another pitfall is a developer will assume an item is present in the cache although it is not. The ASP.NET application will automatically remove infrequently used items from the cache ever so often to minimize memory consumption. So it is not wise to assume that the item will always be there.

Source:
Spaanjaars, Imar. Beginning ASP.NET IN C# AND VB. Indianapolis, IN: Wiley Publishing, Inc., 2010.

Share on FacebookShare on Twitter
Pin it on PinterestShare on LinkedInShare on TumblrSubmit to StumbleUponhttp://blog.nugenerationwebdesign.com/wp-content/uploads/2012/04/NET.jpgDigg ThisShare via email
  • http://www.cashforsmartphones.com/about sell cell phones online

    That’s great to know. We can take advantage of caching just as long as we keep that in mind.

Switch to our mobile site

Disclaimer