public static List <UserMenuInfo> GetAllUserMenus() { var retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey); if (retval == null) { retval = DataProvider.UserMenuDao.GetUserMenuInfoList(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
public static Dictionary <string, AccessTokenInfo> GetAccessTokenDictionary() { var retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey); if (retval == null) { retval = DataProvider.AccessTokenDao.GetAccessTokenInfoDictionary(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
public static List <KeyValuePair <string, TableStyleInfo> > GetAllTableStyles() { var retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey); if (retVal != null) { return(retVal); } lock (LockObject) { retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey); if (retVal == null) { retVal = DataProvider.TableStyleDao.GetAllTableStyles(); DataCacheManager.Insert(CacheKey, retVal); } } return(retVal); }
public static Dictionary <int, List <ContentGroupInfo> > GetAllContentGroups() { var retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey); if (retval != null) { return(retval); } lock (LockObject) { retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey); if (retval == null) { retval = DataProvider.ContentGroupDao.GetAllContentGroups(); DataCacheManager.Insert(CacheKey, retval); } } return(retval); }
private static string GetContentByFilePath(string filePath) { try { var content = DataCacheManager.Get <string>(filePath); if (content != null) { return(content); } if (FileUtils.IsFileExists(filePath)) { content = FileUtils.ReadText(filePath, Encoding.UTF8); } DataCacheManager.Insert(filePath, content, TimeSpan.FromHours(12), filePath); return(content); } catch { return(string.Empty); } }
public static List <KeyValuePair <int, AreaInfo> > GetAreaInfoPairList() { lock (LockObject) { var list = DataCacheManager.Get <List <KeyValuePair <int, AreaInfo> > >(CacheKey); if (list != null) { return(list); } var pairListFormDb = DataProvider.AreaDao.GetAreaInfoPairList(); list = new List <KeyValuePair <int, AreaInfo> >(); foreach (var pair in pairListFormDb) { var areaInfo = pair.Value; if (areaInfo != null) { list.Add(pair); } } DataCacheManager.Insert(CacheKey, list); return(list); } }