diff --git a/src/HelloShop.AppHost/HelloShop.AppHost.csproj b/src/HelloShop.AppHost/HelloShop.AppHost.csproj index 0b4dd96..0d68099 100644 --- a/src/HelloShop.AppHost/HelloShop.AppHost.csproj +++ b/src/HelloShop.AppHost/HelloShop.AppHost.csproj @@ -16,5 +16,6 @@ + \ No newline at end of file diff --git a/src/HelloShop.AppHost/Program.cs b/src/HelloShop.AppHost/Program.cs index fdef62a..fe936b5 100644 --- a/src/HelloShop.AppHost/Program.cs +++ b/src/HelloShop.AppHost/Program.cs @@ -3,13 +3,15 @@ var builder = DistributedApplication.CreateBuilder(args); +var cache = builder.AddRedis("cache", port:6379); + var identityService = builder.AddProject("identityservice"); var orderingService = builder.AddProject("orderingservice").WithReference(identityService); var productService = builder.AddProject("productservice").WithReference(identityService); -var basketService = builder.AddProject("basketservice").WithReference(identityService); +var basketService = builder.AddProject("basketservice").WithReference(identityService).WithReference(cache); var apiservice = builder.AddProject("apiservice") .WithReference(identityService) diff --git a/src/HelloShop.BasketService/HelloShop.BasketService.csproj b/src/HelloShop.BasketService/HelloShop.BasketService.csproj index f555e61..6aea2ac 100644 --- a/src/HelloShop.BasketService/HelloShop.BasketService.csproj +++ b/src/HelloShop.BasketService/HelloShop.BasketService.csproj @@ -13,10 +13,12 @@ + + diff --git a/src/HelloShop.BasketService/Program.cs b/src/HelloShop.BasketService/Program.cs index e0f29d5..2c2235d 100644 --- a/src/HelloShop.BasketService/Program.cs +++ b/src/HelloShop.BasketService/Program.cs @@ -24,7 +24,7 @@ builder.Services.AddAuthentication().AddJwtBearer(options => }); builder.Services.AddHttpContextAccessor(); -builder.Services.AddDistributedMemoryCache(); +builder.AddRedisDistributedCache("cache"); builder.Services.AddSingleton(); builder.Services.AddGrpc(options => options.EnableMessageValidation()).AddJsonTranscoding();