Wednesday 13 November 2013

Caching in ASP.NET advantage and example

Leave a Comment

Caching in ASP.NET

Today i want to discuss, how to improve web performance in asp.net. One of the approach are using Caching in asp.net application. The caching is a must in a Web application right now. This is because the caching will fasten access data directly from memory(RAM) rather than access in Hard Disk.

This are advantage of using Caching in Web Application

Advantage :

  • Reduce round-trips: Content cached at the client or in proxies can eliminate web server round-trips. Content cached at the web server can eliminate database round-trips.
  • Move content closer to clients: The farther away from clients content is located, the longer it takes to retrieve that content.
  • Avoid time-consuming processes of regenerating reusable content: For content that takes a lot of time or resources to generate, system performance and scalability are improved if you can generate content once and then reuse it many times.
  • Optimize state management: Caching state information at the client is more scalable than storing it in a central location

use caching in ASP.NET is very simple. See the code below for example :

  //store value into cache
  HttpContext.Current.Cache["<cache key name>"] = new DataTable();

  //access value from cache
  if (HttpContext.Current.Cache["<cache key name>"] != null)//checking if cache is null or not
  {
      DataTable table = (DataTable)HttpContext.Current.Cache["<cache key name>"];
  }


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.