コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }