feat(Ocelot.Cache.CacheManager): add and configure

This commit is contained in:
tekh 2025-08-08 13:53:29 +02:00
parent d113d4fcdd
commit f60bb79920
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
@ -13,7 +13,8 @@
<PackageReference Include="NLog" Version="5.4.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
<PackageReference Include="Ocelot" Version="22.0.1" />
<PackageReference Include="Ocelot" Version="23.4.3" />
<PackageReference Include="Ocelot.Cache.CacheManager" Version="23.4.3" />
</ItemGroup>
</Project>

View File

@ -2,6 +2,7 @@ using NLog;
using NLog.Web;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using Ocelot.Cache.CacheManager;
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
logger.Info("Logging initialized.");
@ -23,7 +24,9 @@ try
builder.Configuration.AddJsonFile($"ocelot{suffix}.json");
// Add Ocelot services
builder.Services.AddOcelot();
builder.Services
.AddOcelot()
.AddCacheManager(x => x.WithDictionaryHandle());
var app = builder.Build();