feat(dal): RedisCacheService - работа с Hash объектами
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user