Add redis

This commit is contained in:
Laura Hausmann 2021-01-29 23:00:35 +01:00
parent 531276c3cd
commit a5747560c5
Signed by: zotan
GPG key ID: 5EC1D38FFC321311
3 changed files with 13 additions and 0 deletions

View file

@ -1,4 +1,5 @@
using System.IO;
using System.Threading;
using bahnplan.web.database;
using LinqToDB.Common;
using LinqToDB.Data;
@ -11,6 +12,7 @@ namespace bahnplan.web {
DataConnection.DefaultSettings = new Database.Settings();
Configuration.Linq.AllowMultipleQuery = true;
Directory.CreateDirectory(Variables.TicketDir);
ThreadPool.SetMinThreads(100,100);
CreateHostBuilder(args).Build().Run();
}

View file

@ -21,8 +21,18 @@ namespace bahnplan.web {
});
#if (DEBUG)
services.AddControllers().AddRazorRuntimeCompilation();
services.AddControllers();
services.AddStackExchangeRedisCache(options => {
options.Configuration = "localhost";
options.InstanceName = "bahnplan_development";
});
#else
services.AddControllers();
services.AddStackExchangeRedisCache(options =>
{
options.Configuration = "localhost";
options.InstanceName = "bahnplan_production";
});
#endif
}

View file

@ -73,6 +73,7 @@
<PackageReference Include="linq2db" Version="2.9.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.4" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
</ItemGroup>