Created
January 25, 2020 18:25
-
-
Save kasunkv/b6cd9b78df27687ddd93f52834d192e1 to your computer and use it in GitHub Desktop.
Custom set the cache expiry for Azure App Configuration Feature Management
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MusicStore.Web | |
{ | |
public class Program | |
{ | |
... | |
public static IHostBuilder CreateHostBuilder(string[] args) => | |
Host.CreateDefaultBuilder(args) | |
.ConfigureWebHostDefaults(webBuilder => { | |
webBuilder.UseStartup<Startup>(); | |
}) | |
.ConfigureAppConfiguration((context, config) => { | |
var settings = config.Build(); | |
var appConfigConnection = settings["ConnectionStrings:AppConfiguration"]; | |
if (!string.IsNullOrEmpty(appConfigConnection)) | |
{ | |
config.AddAzureAppConfiguration(options => | |
{ | |
options | |
.Connect(settings["ConnectionStrings:AppConfiguration"]) | |
.UseFeatureFlags(opt => { | |
opt.CacheExpirationTime = TimeSpan.FromSeconds(5); // Set cache expiry to 5 seconds | |
}); | |
}); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment