Я использую кэш Redis, следуя этому примеру от Microsoft, в приложении со страницами Razor. и я использую Orchestration для регистрации кеша, следуя этому примеру.
Вот мой код Program.cs в проекте AppHost
Код: Выделить всё
var builder = DistributedApplication.CreateBuilder(args);
var cache = builder.AddRedisContainer("rediscache");
builder.AddProject
("frontend")
.WithReference(cache)
Код: Выделить всё
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
builder.AddRedisOutputCache("rediscache");
etc...
Код: Выделить всё
var app = builder.Build();
app.UseOutputCache();
etc...
Код: Выделить всё
[OutputCache(Duration = 5)]
Подробнее здесь: https://stackoverflow.com/questions/775 ... ing-effect
Мобильная версия