Last active
June 24, 2021 16:22
-
-
Save ealsur/556960c552f4122ff7d35668be9ac741 to your computer and use it in GitHub Desktop.
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
public void ConfigureServices(IServiceCollection services) | |
{ | |
/* Other service configurations */ | |
services.AddCosmosCache((CosmosCacheOptions cacheOptions) => | |
{ | |
CosmosClientBuilder clientBuilder = new CosmosClientBuilder("myConnectionString") | |
.WithApplicationRegion("West US"); | |
cacheOptions.ContainerName = "myContainer"; | |
cacheOptions.DatabaseName = "myDatabase"; | |
cacheOptions.ClientBuilder = clientBuilder; | |
/* Creates the container if it does not exist */ | |
cacheOptions.CreateIfNotExists = true; | |
}); | |
services.AddSession(options => | |
{ | |
options.IdleTimeout = TimeSpan.FromSeconds(3600); | |
options.Cookie.IsEssential = true; | |
}); | |
/* Other service configurations */ | |
} | |
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
{ | |
/* Other configurations */ | |
app.UseSession(); | |
/* app.UseEndpoints and other configurations */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment