c#简单缓存使用,添加和修改

       private void SetCache(string CacheKey, object objObject, DateTime dt)
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            objCache.Insert(CacheKey, objObject, null, dt, TimeSpan.Zero, System.Web.Caching.CacheItemPriority.NotRemovable, null);
        }

        /// <summary>
        /// 获取数据缓存
        /// </summary>
        /// <param name="CacheKey"></param>
        private object GetCache(string CacheKey)
        {
            System.Web.Caching.Cache objCache = HttpRuntime.Cache;
            return objCache[CacheKey];
        }

 

posted on 2016-05-19 11:03  算顺网  阅读(740)  评论(0编辑  收藏  举报

导航