/// <summary> /// 获取当前枚举映射导航器 /// </summary> /// <param name="enumType"></param> /// <returns></returns> private static EnumMapper GetMapper(Type enumType) { string cacheKey = GetEnumMapCacheKey(enumType); var mapper = _DataMemoryCache.GetValue <EnumMapper>(cacheKey); if (mapper.IfIsNullOrEmpty()) { mapper = new EnumMapper(enumType); _DataMemoryCache.SetValue(cacheKey, mapper); } return(mapper); }
public async Task Save(ApplicationSettings applicationSettings) { using (IDocumentSession querySession = _documentStore.OpenSession()) { ApplicationSettingsData data = MapToData(applicationSettings); querySession.Store(data); await querySession.SaveChangesAsync(); } _memoryCache.SetValue(AppSettings, applicationSettings, applicationSettings.ApplicationSettingsCacheTimeout); }