17 lines
565 B
C#
17 lines
565 B
C#
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
||
|
builder.Services.AddKeyedSingleton<ICache, BigCache>("big");
|
||
|
builder.Services.AddKeyedSingleton<ICache, SmallCache>("small");
|
||
|
builder.Services.AddControllers();
|
||
|
|
||
|
var app = builder.Build();
|
||
|
|
||
|
app.MapGet("/", ([FromKeyedServices("big")] ICache bigCache) =>
|
||
|
bigCache.Get("date"));
|
||
|
|
||
|
app.MapGet("/small", ([FromKeyedServices("small")] ICache smallCache) =>
|
||
|
smallCache.Get("date"));
|
||
|
|
||
|
app.MapControllers();
|
||
|
|
||
|
app.Run();
|