♻️ Refactor cache system with redis
🐛 Add lock to check in prevent multiple at the same time
This commit is contained in:
@ -29,6 +29,7 @@ using Microsoft.OpenApi.Models;
|
||||
using NodaTime;
|
||||
using NodaTime.Serialization.SystemTextJson;
|
||||
using Quartz;
|
||||
using StackExchange.Redis;
|
||||
using tusdotnet;
|
||||
using tusdotnet.Models;
|
||||
using tusdotnet.Models.Configuration;
|
||||
@ -44,6 +45,13 @@ builder.WebHost.ConfigureKestrel(options => options.Limits.MaxRequestBodySize =
|
||||
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
|
||||
|
||||
builder.Services.AddDbContext<AppDatabase>();
|
||||
builder.Services.AddSingleton<IConnectionMultiplexer>(sp =>
|
||||
{
|
||||
var connection = builder.Configuration.GetConnectionString("FastRetrieve")!;
|
||||
return ConnectionMultiplexer.Connect(connection);
|
||||
});
|
||||
|
||||
builder.Services.AddScoped<ICacheService, CacheServiceRedis>();
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddControllers().AddJsonOptions(options =>
|
||||
|
Reference in New Issue
Block a user