public List <string> RunCommand(ChannelMessageEventDataModel messageEvent, GroupCollection arguments = null, bool useCache = true) { var enabledChannels = ConfigHelpers.LoadConfig <ChannelUriConfigModel>(ConfigHelpers.ConfigPaths.ChannelUriConfig).YouTubeEnabledChannels; if (!enabledChannels.Contains(messageEvent.Channel)) { return(null); } string videoId = arguments[1].Value; YouTubeApiConfigModel config = ConfigHelpers.LoadConfig <YouTubeApiConfigModel>(ConfigHelpers.ConfigPaths.YouTubeApiConfig); YouTubeApiModels.ContentDetailsRoot video = JsonConvert.DeserializeObject <YouTubeApiModels.ContentDetailsRoot>( Http.GetJson(new Uri( $"https://www.googleapis.com/youtube/v3/videos?part=contentDetails%2C+snippet%2C+statistics&id={videoId}&key={config.ApiKey}"))); if (video.PageInfo.TotalResults == 0) { return(new List <string> { "Video not found" }); } var item = video.Items[0]; return(new List <string> { $"{item.Snippet.Title} | {item.Snippet.ChannelTitle} - https://www.youtube.com/watch?v={item.Id}" }); }
protected AzureManagerTests(bool useBlobListCache) { string connectionString = ConfigHelpers.GetConnectionString(); string containerName = ConfigHelpers.GetContainerName(); this.azureManager = new AzureManager(connectionString, containerName, "/Testing", useBlobListCache); }
protected override XElement MakeWorkerConfig(string configPath) { Dictionary <string, string> environment = new Dictionary <string, string>(this.Context.JobEnvironmentVariables); environment.Add(Constants.LoggingLevelEnvVar, Constants.LoggingStringFromLevel((int)Context.RuntimeLoggingLevel).ToString()); // add job-local resources to each worker directory, leaving out the standard Dryad files var resources = new List <XElement>(); foreach (var rg in LocalResources) { resources.Add(MakeResourceGroup(rg.Key, rg.Value)); } int numWorkerProcesses = 2; if (Context.JobMaxNodes.HasValue) { numWorkerProcesses = Context.JobMaxNodes.Value; } var psPath = Path.Combine(Context.DryadHomeDirectory, "Microsoft.Research.Dryad.ProcessService.exe"); string[] psArgs = { configPath }; return(ConfigHelpers.MakeProcessGroup( "Worker", "local", 2, numWorkerProcesses, Context.ContainerMbMemory, false, psPath, psArgs, null, "processservice-stdout.txt", "processservice-stderr.txt", resources, environment)); }
//////////////// public void Reset() { JsonConvert.PopulateObject("{}", this, ConfigManager.serializerSettings); this.PointsDisplayColorRGB = new byte[] { Color.YellowGreen.R, Color.YellowGreen.G, Color.YellowGreen.B }; ConfigHelpers.SyncConfig(this); }
public List <string> RunCommand(ChannelMessageEventDataModel messageEvent, GroupCollection arguments = null, bool useCache = true) { WeatherApiConfigModel weatherApiConfig = ConfigHelpers.LoadConfig <WeatherApiConfigModel>(ConfigHelpers.ConfigPaths.WeatherApiConfig); if (!weatherApiConfig.UserDefaultLocale.ContainsKey(messageEvent.Nick)) { return($"User has no default locale set, use '{messageEvent.MessageWithPrefix[0]}{arguments[0].Value} set <locale>' command to set a locale.".SplitInParts(430).ToList()); } CurrentWeatherModel.CurrentWeather currentWeather; bool shortQuery = arguments[0].Value == "ws"; try { currentWeather = Weather.GetCurrentWeatherAsync(weatherApiConfig.UserDefaultLocale[messageEvent.Nick], weatherApiConfig.ApiKey).Result; } catch (Exception e) { if (e.InnerException is QueryNotFoundException) { return("Could not find given location.".SplitInParts(430).ToList()); } throw; } return(FormatResponse.FormatWeatherResponse(currentWeather.Current, currentWeather.Location, shortWeather: shortQuery) .SplitInParts(430) //.Concat(FormatResponse.FormatForecastResponse(forecastWeather.Forecast, forecastWeather.Location, shortWeather: shortQuery)) .ToList()); }
protected override XElement MakeJMConfig() { var environment = new Dictionary <string, string>(); environment.Add("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + Context.PeloponneseHomeDirectory); var jarPath = Path.Combine(Context.PeloponneseHomeDirectory, "Peloponnese-HadoopBridge.jar"); environment.Add("PELOPONNESE_ADDITIONAL_CLASSPATH", jarPath); // add the query plan to the JM directory so that job analysis tools can find it later string queryPlanDirectory = Path.GetDirectoryName(QueryPlan); string queryPlanFile = Path.GetFileName(QueryPlan); HashSet <string> queryPlanSet = new HashSet <string>(); queryPlanSet.Add(queryPlanFile); List <XElement> resources = new List <XElement>(); resources.Add(MakeResourceGroup(queryPlanDirectory, queryPlanSet)); string logDirectory = Path.Combine(m_workingDirectory, "log"); Uri logUri = new Uri("file:///" + logDirectory + "/"); string logDirParam = Microsoft.Research.Peloponnese.Storage.AzureUtils.CmdLineEncode(logUri.AbsoluteUri); var jmPath = Path.Combine(Context.DryadHomeDirectory, "DryadLinqGraphManager.exe"); var vertexPath = Path.Combine(Context.DryadHomeDirectory, "VertexHost.exe"); string[] jmArgs = { "--dfs=" + logDirParam, vertexPath, queryPlanFile }; return(ConfigHelpers.MakeProcessGroup( "jm", "local", 1, 1, true, jmPath, jmArgs, null, "graphmanager-stdout.txt", "graphmanager-stderr.txt", resources, environment)); }
public void Setup() { CommandExplorer.Discover(); LmkStorage.LmkStorageFile = "nofile.txt"; LmkStorage.GenerateTestLmks(false); ConfigHelpers.SetAuthorizedState(true); }
public static XDocument MakePeloponneseConfig( int numberOfProcesses, int workerMemoryInMB, string type, string commandLine, IEnumerable <string> commandLineArgs, bool addRedirects, IEnumerable <XElement> resources) { XDocument configDoc = new XDocument(); XElement docElement = new XElement("PeloponneseConfig"); XElement serverElement = new XElement("PeloponneseServer"); XElement portElement = new XElement("Port"); portElement.Value = "8471"; serverElement.Add(portElement); XElement prefixElement = new XElement("Prefix"); prefixElement.Value = "/peloponnese/server/"; serverElement.Add(prefixElement); XElement workers = ConfigHelpers.MakeProcessGroup( "Worker", type, 1, numberOfProcesses, workerMemoryInMB, true, commandLine, commandLineArgs, "LOG_DIRS", "stdout.txt", "stderr.txt", resources, null); serverElement.Add(workers); docElement.Add(serverElement); configDoc.Add(docElement); return(configDoc); }
public void FormZmkFromTwoToNineComponentsTest() { ConfigHelpers.SetAuthorizedState(true); ConfigHelpers.SetLegacyMode(false); Assert.AreEqual("00C0BC1DFFC449A402DAB71250CA5869CC8CE39643DA9A9B99", TestMessage( "32EC8A0412B5D0E86E3C1E5ABFA19B3F5FF43378ED5D85B1BC465BF000335FBF1A235EDF4C58A2CB0C84641D07319CF21", new FormZMKFromTwoToNineComponents_GY())); Assert.AreEqual("00U369835189A058604EB7F84EAE10C7D048CE396", TestMessage( "32EC8A0412B5D0E86E3C1E5ABFA19B3F5FF43378ED5D85B1BC465BF000335FBF1A235EDF4C58A2CB0C84641D07319CF21;0U1", new FormZMKFromTwoToNineComponents_GY())); Assert.AreEqual("00XC0BC1DFFC449A402DAB71250CA5869CC8CE39643DA9A9B99", TestMessage( "32EC8A0412B5D0E86E3C1E5ABFA19B3F5FF43378ED5D85B1BC465BF000335FBF1A235EDF4C58A2CB0C84641D07319CF21;0X0", new FormZMKFromTwoToNineComponents_GY())); Assert.AreEqual("15", TestMessage( "3U2EC8A0412B5D0E86E3C1E5ABFA19B3F5FF43378ED5D85B1BC465BF000335FBF1A235EDF4C58A2CB0C84641D07319CF21;0X0", new FormZMKFromTwoToNineComponents_GY())); ConfigHelpers.SetAuthorizedState(false); Assert.IsTrue(CommandExplorer.GetCommand(CommandType.Host, "GY").RequiresAuthorizedState); }
public void GenerateAndPrintComponentTest() { ConfigHelpers.SetAuthorizedState(true); Extensions.RndMachine = new NotSoRandom(); string rsp; string rspAfterIo; TestMessageWithIo("001U", new GenerateAndPrintComponent_A2(), out rsp, out rspAfterIo); Assert.AreEqual("00U37C214786596A294ED92DBA27208C13B", rsp); Assert.IsNotNullOrEmpty(rspAfterIo); TestMessageWithIo("001T", new GenerateAndPrintComponent_A2(), out rsp, out rspAfterIo); Assert.AreEqual("00T07481EB9B807DF6E4AAF814F18038290CE01C666B4B2F652", rsp); Assert.IsNotNullOrEmpty(rspAfterIo); TestMessageWithIo("002X", new GenerateAndPrintComponent_A2(), out rsp, out rspAfterIo); Assert.AreEqual("00X3A6F3B5520B820EC3A6F3B5520B820EC", rsp); Assert.IsNotNullOrEmpty(rspAfterIo); TestMessageWithIo("002Y", new GenerateAndPrintComponent_A2(), out rsp, out rspAfterIo); Assert.AreEqual("00Y3A6F3B5520B820EC3A6F3B5520B820EC3A6F3B5520B820EC", rsp); Assert.IsNotNullOrEmpty(rspAfterIo); Extensions.RndMachine = new RandomMachine(); ConfigHelpers.SetAuthorizedState(false); Assert.IsTrue(CommandExplorer.GetCommand(CommandType.Host, "A2").RequiresAuthorizedState); }
protected override string MiningCreateCommandLine() { // API port function might be blocking _apiPort = GetAvaliablePort(); // instant non blocking var urlWithPort = GetLocationUrl(_algorithmType, _miningLocation, NhmConectionType.NONE); var binPathBinCwdPair = GetBinAndCwdPaths(); var binCwd = binPathBinCwdPair.Item2; var algo = AlgorithmName(_algorithmType); // prepare configs var folder = _algorithmType.ToString().ToLower(); // run in new task so we don't deadlock main thread var deviceConfigParams = Task.Run(() => PrepareDeviceConfigs(CancellationToken.None)).Result; var generalConfigFilePath = Path.Combine(binCwd, folder, "config.txt"); var generalConfig = new MainConfig { httpd_port = _apiPort }; ConfigHelpers.WriteConfigFile(generalConfigFilePath, generalConfig); var poolsConfigFilePath = Path.Combine(binCwd, folder, "pools.txt"); var poolsConfig = new PoolsConfig(urlWithPort, _username, algo); ConfigHelpers.WriteConfigFile(poolsConfigFilePath, poolsConfig); var disableDeviceTypes = CommandLineHelpers.DisableDevCmd(_miningDeviceTypes); var commandLine = $@"--config {folder}\config.txt --poolconf {folder}\pools.txt {deviceConfigParams} {disableDeviceTypes}"; return(commandLine); }
private void MakeJobResourceGroups(string exeName, string jobStaging, out XElement frameworkGroup, out XElement jobGroup) { string[] naiadComponentsArray = { "Naiad.dll", "Naiad.pdb" }; HashSet <string> naiadComponents = new HashSet <string>(); foreach (string c in naiadComponentsArray) { naiadComponents.Add(c); } string[] dependencies = Dependencies(exeName); if (File.Exists(exeName + ".config")) { dependencies = dependencies.Concat(new[] { exeName + ".config" }).ToArray(); } IEnumerable <string> frameworkDependencies = dependencies.Where(x => naiadComponents.Contains(Path.GetFileName(x))); frameworkGroup = ConfigHelpers.MakeResourceGroup(dfsClient, dfsClient.Combine("staging", "naiad"), true, frameworkDependencies); IEnumerable <string> jobDependencies = dependencies.Where(x => !naiadComponents.Contains(Path.GetFileName(x))); jobGroup = ConfigHelpers.MakeResourceGroup(dfsClient, jobStaging, false, jobDependencies); }
public void DecryptEncryptedPinTest() { ConfigHelpers.SetAuthorizedState(true); Assert.AreEqual("001234F", TestMessage("12345678901201234", new DecryptEncryptedPIN_NG())); ConfigHelpers.SetAuthorizedState(false); Assert.IsTrue(CommandExplorer.GetCommand(CommandType.Host, "NG").RequiresAuthorizedState); }
public TrafficWizardCtr() { config = ConfigHelpers.GetConfigHelper().GetConfig(ConstModel.CONFIG_FILE_PATH); rSFU = new ReadSrcFileUtils(srcFileContentQ, reportContentQ, config.srcFilePath, config.tagetFilePath); hc = new HttpClientUtils(config.token); }
public void CancelAuthStateTest() { ConfigHelpers.SetAuthorizedState(true); Assert.AreEqual("00", TestMessage("", new CancelAuthState_RA())); Assert.IsFalse(ConfigHelpers.IsInAuthorizedState()); ConfigHelpers.SetSingleLengthZmk(); }
public async Task <IEnumerable <MovieModel> > GetMovies(IEnumerable <string> ids) { _logger.LogInformation("Calling remote service..."); try { var json = JsonSerializer.Serialize(ids); var toSend = new StringContent(json, Encoding.UTF8, "application/json"); var serviceUrl = await ConfigHelpers.GetServiceInfo(_settings.ServiceDiscoveryAddress, _settings.MoviesServiceName); var client = _httpClient.CreateClient("MoviesService"); client.BaseAddress = serviceUrl; var response = await client.PostAsync("/api/v1/movies/search", toSend); if (!response.IsSuccessStatusCode) { return(new List <MovieModel>()); } var content = await response.Content.ReadAsStringAsync(); var movies = JsonSerializer.Deserialize <IList <MovieModel> >(content, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true }); return(movies); } catch (Exception e) { _logger.LogError(e.ToString()); return(null); } }
//////////////// public void Reset() { JsonConvert.PopulateObject("{}", this, ConfigManager.serializerSettings); this.ShopLoadout = new List <ShopPackDefinition>(); ConfigHelpers.SyncConfig(this); }
public void Ctor_CheckContainerNotExist() { string connectionString = ConfigHelpers.GetConnectionString(); Assert.ThrowsAny <Exception>( () => new AzureManager(connectionString, "notexist", null, false)); }
public void ExportKeyTest() { ConfigHelpers.SetAuthorizedState(true); Assert.AreEqual("0035ED0C0EA7F7D0FA0035BB", TestMessage("0024ED06495741C280C0406FBB23A5214DFZ", new ExportKey_A8())); ConfigHelpers.SetDoubleLengthZmk(); Assert.AreEqual("0016224FDAA779AFB31FFD3C", TestMessage("002U1457FF6ADF6250C66C368416B4C9D3837BB126F2BE631486Z", new ExportKey_A8())); Assert.AreEqual("00U2C62A23D001B97412950CD8BE66C7639070753", TestMessage("002U1457FF6ADF6250C66C368416B4C9D383U8463435FC4B4DAA0C49025272C29B12CU", new ExportKey_A8())); }
public static void SaveConfig(UrlHistoryConfigModel.UrlHistoryConfig config, bool syncToCache = true) { if (syncToCache) { Cache.Set(CacheName, config, DateTimeOffset.Now.AddMinutes(CacheExpiration)); } ConfigHelpers.SaveConfig(config, ConfigHelpers.ConfigPaths.UrlHistoryConfig); }
protected override XElement MakeWorkerConfig(string configPath, XElement peloponneseResource) { var waiters = new List <Task <XElement> >(); IEnumerable <string> dryadFiles = new[] { "ProcessService.exe", "ProcessService.pdb", "VertexHost.exe", "VertexHost.pdb", "VertexHost.exe.config", "Microsoft.Research.DryadLinq.dll", "Microsoft.Research.DryadLinq.pdb", "DryadLinqNativeChannels.dll", "DryadLinqNativeChannels.pdb", "DryadManagedChannel.dll", "DryadManagedChannel.pdb" }; dryadFiles = dryadFiles.Select(x => Path.Combine(Context.DryadHomeDirectory, x)); waiters.Add(ConfigHelpers.MakeResourceGroupAsync(Context.Cluster.DfsClient, DryadDfs, true, dryadFiles)); // add job-local resources to each worker directory, using public versions of the standard Dryad files foreach (var rg in LocalResources) { IEnumerable <string> files = rg.Value.Select(x => Path.Combine(rg.Key, x)); waiters.Add(ConfigHelpers.MakeResourceGroupAsync(Context.Cluster.DfsClient, UserDfs, false, files)); } try { Task.WaitAll(waiters.ToArray()); } catch (Exception e) { throw new DryadLinqException("Dfs resource make failed", e); } var resources = new List <XElement>(); resources.Add(peloponneseResource); foreach (var t in waiters) { resources.Add(t.Result); } var psPath = "ProcessService.exe"; string[] psArgs = { Path.GetFileName(configPath) }; int maxNodes = (Context.JobMaxNodes == null) ? -1 : Context.JobMaxNodes.Value; return(ConfigHelpers.MakeProcessGroup( "Worker", "yarn", -1, maxNodes, false, psPath, psArgs, "LOG_DIRS", "processservice-stdout.txt", "processservice-stderr.txt", resources, null)); }
public void EncryptClearPinTest() { ConfigHelpers.SetAuthorizedState(true); Assert.AreEqual("0001234", TestMessage("1234F" + "012345678901", new EncryptClearPIN_BA())); Assert.AreEqual("0001234", TestMessage("01234" + "012345678901", new EncryptClearPIN_BA())); ConfigHelpers.SetAuthorizedState(false); Assert.IsTrue(CommandExplorer.GetCommand(CommandType.Host, "BA").RequiresAuthorizedState); }
public void should_raise_exception_in_calling_thread_on_authentification_failure() { var properties = ConfigHelpers.LoadConfig(); var client = new Client(); client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], properties["Username"], "some silly password to make sure the authentification fail"); }
public void Init() { var properties = ConfigHelpers.LoadConfig(); // create a client and connect to the broker _client = new Client(); _client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], properties["Username"], properties["Password"]); }
//////////////// public void Reset() { JsonConvert.PopulateObject("{}", this, ConfigManager.serializerSettings); this.NpcRewardsOnKill = new Dictionary <NPCDefinition, NPCKillRewardValue>(); this.NpcRewardRequiredAsBoss = new HashSet <NPCDefinition>(); this.NpcRewardNotGivenAfterNpcKilled = new Dictionary <NPCDefinition, NPCDefinition>(); ConfigHelpers.SyncConfig(this); }
private void But_Save_Click(object sender, EventArgs e) { if (TexBox_MachineGUID.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.MachineGUID = TexBox_MachineGUID.Text; } if (TexBox_LocalLogOutput.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.LocalLogOutput = TexBox_LocalLogOutput.Text; } if (TexBox_MachineName.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.MachineName = TexBox_MachineName.Text; } if (TexBox_MasterServerURL.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.MasterServerURL = TexBox_MasterServerURL.Text; } if (TexBox_MasterStarterMasterLoc.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.MasterStarterMasterLoc = TexBox_MasterStarterMasterLoc.Text; } if (TexBox_Password.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.ServerCredential.Password = TexBox_Password.Text; } if (TexBox_UserName.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.ServerCredential.UserName = TexBox_UserName.Text; } if (TexBox_ServerLogOutput.Text.Trim() != "") { ArcadeGameStartAndStopService.MainConfig.ServerLogOutput = TexBox_ServerLogOutput.Text; } //if (TexBox_ServerLogOutput.Text.Trim() != "") //depreciated with game selector // Config.DefualtGameGUID = TexBox_DefualtGameGUID.Text; ArcadeGameStartAndStopService.MainConfig.StarterMode = GetGameStartModeFromString(LisBox_GameStarterMode.Items[LisBox_GameStarterMode.SelectedIndex].ToString()); ArcadeGameStartAndStopService.MainConfig.ServerMode = GetServerModeFromString(LisBox_GameStarterMode.Items[LisBox_GameStarterMode.SelectedIndex].ToString()); ArcadeGameStartAndStopService.MainConfig.CardModeMode = GetCardModeFromString(LisBox_GameStarterMode.Items[LisBox_GameStarterMode.SelectedIndex].ToString()); Dictionary <string, List <string> > Errors; if (!ConfigHelpers.ValidateConfig(ArcadeGameStartAndStopService.MainConfig, out Errors)) { ShowingErrorAlready = true; MessageBox.Show(ConfigHelpers.ConvertErrorsToMessage(Errors)); return; } ShowingErrorAlready = true; ArcadeGameStartAndStopService.Logger.WriteLog("'Arcade Game Start And Stop Service' has changed config."); JSONServiceConfig.SaveJSONServiceConfig(ArcadeGameStartAndStopService.MainConfig); Close(); }
public void should_not_block_on_close() { var properties = ConfigHelpers.LoadConfig(); var client = new Client(); client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"], properties["Username"], properties["Password"]); client.Close(); }
public void ImportCover(MovieSheetsGenerator generator, bool IsLoadFromMetadata, MoviesheetsUpdateManager metadatamanager) { if (!string.IsNullOrEmpty(this.CoverPath)) { generator.UpdateCover(this.CoverPath); return; } bool _coverDone = false; //process cover // if import is selected and mask is not empty if (FileManager.Configuration.Options.MovieSheetsOptions.AutoSelectFolderjpgAsCover && !string.IsNullOrEmpty(FileManager.Configuration.Options.MovieSheetsOptions.AutoSelectFolderjpgAsCoverName)) { string _coverPath = null; if (ConfigHelpers.CheckIfFileExists(MoviePath, FileManager.Configuration.Options.MovieSheetsOptions.AutoSelectFolderjpgAsCoverName, out _coverPath)) { CoverPath = _coverPath; // signal that MyOwnThumbnailFromDiskImage should be updated IsMyOwnThumbnailFromDiskImageRequired = true; // update the sheets generators if (generator != null) { generator.UpdateCover(_coverPath); } _coverDone = true; } } if (metadatamanager == null) { metadatamanager = MetadataManager; } if (!_coverDone && IsLoadFromMetadata && metadatamanager != null) { string _tmpCover = Helpers.GetUniqueFilename(".jpg"); FileManager.AddToGarbageFiles(_tmpCover); _coverDone = metadatamanager.GetImage(MoviesheetsUpdateManager.COVER_STREAM_NAME, _tmpCover); if (generator != null) { generator.UpdateCover(_tmpCover); } CoverPath = _tmpCover; IsMyOwnThumbnailFromDiskImageRequired = true; _coverDone = true; } if (!_coverDone && generator != null) { generator.UpdateCover(DefaultCoverPath); } }
public void FormZmkFromThreeComponentsTest() { ConfigHelpers.SetAuthorizedState(true); Assert.AreEqual("00XC0BC1DFFC449A402DAB71250CA5869CC8CE39643DA9A9B99", TestMessage( "A235EDF4C58A2CB0C84641D07319CF21FF43378ED5D85B1BC465BF000335FBF12EC8A0412B5D0E86E3C1E5ABFA19B3F5", new FormZMKFromThreeComponents_GG())); ConfigHelpers.SetAuthorizedState(false); Assert.IsTrue(CommandExplorer.GetCommand(CommandType.Host, "GG").RequiresAuthorizedState); }
// Unless there are external edits to the url_history.json file, the cache should be in sync with the filesystem public static UrlHistoryConfigModel.UrlHistoryConfig GetConfig(bool preferCache = true) { var config = Cache.Get <UrlHistoryConfigModel.UrlHistoryConfig>(CacheName); if (config == null || !preferCache) { config = ConfigHelpers.LoadConfig <UrlHistoryConfigModel.UrlHistoryConfig>(ConfigHelpers .ConfigPaths.UrlHistoryConfig); Cache.Set(CacheName, config, DateTimeOffset.Now.AddMinutes(CacheExpiration)); } return(config); }