cache/auth 不强依赖Redis
This commit is contained in:
@@ -36,11 +36,20 @@ public static class SimApiExtensions
|
||||
{
|
||||
var simApiOptions = new SimApiOptions();
|
||||
options?.Invoke(simApiOptions);
|
||||
|
||||
if (simApiOptions.RedisConfiguration != null)
|
||||
{
|
||||
builder.AddStackExchangeRedisCache(x => x.Configuration = simApiOptions.RedisConfiguration);
|
||||
builder.AddSingleton<IConnectionMultiplexer>(_ =>
|
||||
ConnectionMultiplexer.Connect(simApiOptions.RedisConfiguration));
|
||||
}
|
||||
else if (simApiOptions.EnableSimApiAuth || simApiOptions.EnableSimApiCache)
|
||||
{
|
||||
builder.AddDistributedMemoryCache();
|
||||
}
|
||||
|
||||
if (simApiOptions.EnableSimApiCache)
|
||||
{
|
||||
builder.AddSingleton<SimApiCache>();
|
||||
}
|
||||
|
||||
@@ -360,6 +369,11 @@ public static class SimApiExtensions
|
||||
logger.LogInformation("开始配置 RedisCache ...");
|
||||
}
|
||||
|
||||
if (options.EnableSimApiCache)
|
||||
{
|
||||
logger.LogInformation("开始配置SimApiCache...");
|
||||
}
|
||||
|
||||
//请求一下检测存储错误
|
||||
if (options.EnableSimApiStorage)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user