缓存代码备用

 public List<WhoLearning> GetWhoLearningTop50()
        {
            string CacheKey = "GetWhoLearningTop50";
            object objModel = Maticsoft.Common.DataCache.GetCache(CacheKey);
            if (objModel == null)
            {
               
                    objModel = dal.GetWhoLearningTop50();
                    if (objModel != null)
                    {
                       //int ModelCache = Maticsoft.Common.ConfigHelper.GetConfigInt("ModelCache");
                        Maticsoft.Common.DataCache.SetCache(CacheKey, objModel, DateTime.Now.AddSeconds(10), TimeSpan.Zero);
                    }
               
            }
            return (List<WhoLearning>)objModel;
            
        }

 

posted @ 2016-10-09 09:06  JohnMarnoon  阅读(194)  评论(0编辑  收藏  举报