diff --git a/QRCodeService/QRCodeService.csproj b/QRCodeService/QRCodeService.csproj index 3ef2f5f..83cb3b3 100644 --- a/QRCodeService/QRCodeService.csproj +++ b/QRCodeService/QRCodeService.csproj @@ -29,6 +29,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -37,6 +38,7 @@ + diff --git a/QRCodeService/Startup.cs b/QRCodeService/Startup.cs index 3e35c0c..ecc6f47 100644 --- a/QRCodeService/Startup.cs +++ b/QRCodeService/Startup.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Caching.Redis; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -74,6 +75,8 @@ namespace QRCodeService //Queries services.AddScoped(); services.AddScoped(); + //redis cache + services.AddDistributedRedisCache(options=>options.Configuration=Configuration.GetSection("redis:default").Value); } diff --git a/QRCodeService/appsettings.json b/QRCodeService/appsettings.json index 365ebe8..d2edee1 100644 --- a/QRCodeService/appsettings.json +++ b/QRCodeService/appsettings.json @@ -42,5 +42,12 @@ "Properties": { "Application": "SerilogExample" } + }, + "Redis": { + "Default": { + "Connection": "127.0.0.1:6379", + "InstanceName": "local", + "DefaultDB": 8 + } } }