/// <summary> /// 设置当前应用程序指定CacheKey的Cache值 /// </summary> /// <param name="CacheKey"></param> /// <param name="objObject"></param> /// <param name="absoluteExpiration">设置绝对过期时间</param> public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration) { Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject, null, absoluteExpiration, Cache.NoSlidingExpiration); }
/// <summary> /// 设置当前应用程序指定CacheKey的Cache值 /// </summary> /// <param name="CacheKey"></param> /// <param name="objObject"></param> /// <param name="slidingExpiration">设置滑动过期时间</param> public static void SetCache(string CacheKey, object objObject, TimeSpan slidingExpiration) { Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject, null, Cache.NoAbsoluteExpiration, slidingExpiration); }
/// <summary> /// 设置当前应用程序指定CacheKey的Cache值 /// </summary> /// <param name="CacheKey"></param> /// <param name="objObject"></param> public static void SetCache(string CacheKey, object objObject) { Cache objCache = HttpRuntime.Cache; objCache.Insert(CacheKey, objObject); }