How to use Cache in Class files?

SheoNarayan
Posted by SheoNarayan under ASP.NET category on | Views : 3594

// Removing data from cache
System.Web.HttpContext.Current.Cache.Remove("Mydata");

// Storing data into cache
System.Web.HttpContext.Current.Cache["Mydata"] = MyObject; // this can be a string, or any object

// Getting data from cache
object obj = System.Web.HttpContext.Current.Cache["Mydata"];

Comments or Responses

Login to post response