예제 #1
0
 public static List <KeyValuePair <int, DepartmentInfo> > GetDepartmentInfoKeyValuePair()
 {
     lock (LockObject)
     {
         if (CacheUtils.Get(CacheKey) == null)
         {
             var list = DepartmentDao.GetDepartmentInfoKeyValuePair();
             CacheUtils.Max(CacheKey, list);
             return(list);
         }
         return(CacheUtils.Get(CacheKey) as List <KeyValuePair <int, DepartmentInfo> >);
     }
 }
예제 #2
0
        public static string GetTemplateHtml(TemplateInfo templateInfo)
        {
            var directoryPath = GetTemplatesDirectoryPath();
            var htmlPath      = ApplicationUtils.PathCombine(directoryPath, templateInfo.Name, templateInfo.Main);
            var html          = CacheUtils.Get <string>(htmlPath);

            if (html != null)
            {
                return(html);
            }

            html = ApplicationUtils.ReadText(htmlPath);

            CacheUtils.InsertHours(htmlPath, html, 1);
            return(html);
        }
예제 #3
0
            public static Dictionary <string, int> GetDataCountsCache(int siteId)
            {
                var cacheKey = GetCacheKey(siteId);
                var retval   = CacheUtils.Get <Dictionary <string, int> >(cacheKey);

                if (retval != null)
                {
                    return(retval);
                }

                lock (LockObject)
                {
                    retval = CacheUtils.Get <Dictionary <string, int> >(cacheKey);
                    if (retval == null)
                    {
                        retval = Main.DataRepository.GetDataCounts(siteId);

                        CacheUtils.InsertHours(cacheKey, retval, 1);
                    }
                }

                return(retval);
            }
예제 #4
0
            public static List <CategoryInfo> GetCategoryInfoListByCache(int siteId)
            {
                var cacheKey           = GetCacheKey(siteId);
                var departmentInfoList = CacheUtils.Get <List <CategoryInfo> >(cacheKey);

                if (departmentInfoList != null)
                {
                    return(departmentInfoList);
                }

                lock (LockObject)
                {
                    departmentInfoList = CacheUtils.Get <List <CategoryInfo> >(cacheKey);
                    if (departmentInfoList == null)
                    {
                        departmentInfoList = Main.CategoryRepository.GetCategoryInfoList(siteId);

                        CacheUtils.InsertHours(cacheKey, departmentInfoList, 12);
                    }
                }

                return(departmentInfoList);
            }