I will use the insert method because it supports several overloads dependencies, timeouts, priority, and callbacks.
// Add to cache
Cache["testKey"] = "Promothash";
// Read from cache
Response.Write(Cache["testKey"]);
// to add and set duration of cache to 5 seconds
Cache.Insert("testKey","Promothash", null, System.DateTime.Now.AddSeconds(5),
System.Web.Caching.Cache.NoSlidingExpiration);
It can accept one more argument i.e callback function can be excuted when the
cache expires.Create a delegate of the callback function and call it.
//instance of the callback delegate
Callbackcache callBack = new Callbackcache (obj);