public class DoCatch { /// <summary> // Get the current value of the specified CacheKey Cache object applications /// </summary> /// <param name = "CacheKey"> index key </ param> /// <returns> buffer object returns </ returns> public static object GetCache(string CacheKey) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; return objCache[CacheKey]; } /// <summary> // set the current value of the specified CacheKey Cache object applications /// </summary> /// <param name = "CacheKey"> index key </ param> /// <param name = "objObject"> Cache Object </ param> public static void SetCache(string CacheKey, object objObject) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject); } /// <summary> // set the current value of the specified CacheKey Cache object applications /// </summary> /// <param name = "CacheKey"> index key </ param> /// <param name = "objObject"> Cache Object </ param> /// <param name = "absoluteExpiration"> absolute expiration time </ param> /// <param name = "slidingExpiration"> time expires between the target interval inserted object was last accessed </ param> public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration, TimeSpan slidingExpiration) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; if (objObject != null) objCache.Insert(CacheKey, objObject, null, absoluteExpiration, slidingExpiration); } public static void ClearCache(string key) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Remove(key); } }