Add SQL Server distributed cache configuration
Configured the application to use SQL Server as a distributed cache provider. Added `AddDistributedSqlServerCache` to `Program.cs` and set up the connection string, schema name, and table name from the `Cache:SqlServer` configuration section. This enables persistent and shared caching across multiple application instances.
This commit is contained in:
@@ -269,6 +269,15 @@ try
|
||||
// Cache options
|
||||
builder.Services.Configure<CacheOptions>(config.GetSection(CacheOptions.SectionName));
|
||||
|
||||
// Distributed Cache - SQL Server
|
||||
var sqlCacheConfig = config.GetSection("Cache:SqlServer");
|
||||
builder.Services.AddDistributedSqlServerCache(options =>
|
||||
{
|
||||
options.ConnectionString = sqlCacheConfig["ConnectionString"] ?? connStr;
|
||||
options.SchemaName = sqlCacheConfig["SchemaName"];
|
||||
options.TableName = sqlCacheConfig["TableName"];
|
||||
});
|
||||
|
||||
// Envelope generator serives
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
builder.Services
|
||||
|
||||
Reference in New Issue
Block a user