using System; using System.Web; namespace DotNet.Utilities { /// /// 缓存相关的操作类 /// public class DataCache { /// /// 获取当前应用程序指定CacheKey的Cache值 /// /// /// public static object GetCache(string CacheKey) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; return objCache[CacheKey]; } /// /// 设置当前应用程序指定CacheKey的Cache值 /// /// /// public static void SetCache(string CacheKey, object objObject) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject); } /// /// 设置当前应用程序指定CacheKey的Cache值 /// /// /// public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration,TimeSpan slidingExpiration ) { System.Web.Caching.Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject,null,absoluteExpiration,slidingExpiration); } } } //csharp/8578