feat(dal): RedisCacheService - работа с Hash объектами

This commit is contained in:
Mikhail Trubnikov
2026-03-17 13:50:06 +10:00
parent 3f013e2bfc
commit 547cb894be
5 changed files with 200 additions and 149 deletions

View File

@@ -24,6 +24,7 @@ using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Schedule;
using PARR.DAL.Services.Interfaces.Unit;
using PARR.DAL.Settings;
using StackExchange.Redis;
namespace PARR.DAL
{
@@ -45,16 +46,24 @@ namespace PARR.DAL
#region Redis + cache services
services.AddSingleton<IConnectionMultiplexer>(sp =>
{
// IConnectionMultiplexer - для нативных операций Redis
var connectionString = configuration.GetConnectionString("RedisConnection");
return ConnectionMultiplexer.Connect(connectionString);
});
services.AddStackExchangeRedisCache(opt =>
{
opt.Configuration = configuration.GetConnectionString("RedisConnection");
});
var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings();
configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings);
services.AddSingleton(groupedShortcodesCacheSettings);
services.AddTransient<IRedisCacheService, RedisCacheService>();
services.AddSingleton<IRedisCacheService, RedisCacheService>();
#endregion