feat(dal): CacheMatchigStatusService реализация
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using PARR.DAL.Cache.Models;
|
using PARR.Constants;
|
||||||
|
using PARR.DAL.Cache.Models;
|
||||||
using PARR.DAL.Cache.Services.Base;
|
using PARR.DAL.Cache.Services.Base;
|
||||||
|
|
||||||
namespace PARR.DAL.Cache.Services
|
namespace PARR.DAL.Cache.Services
|
||||||
@@ -12,34 +13,51 @@ namespace PARR.DAL.Cache.Services
|
|||||||
this.redisCacheService = redisCacheService;
|
this.redisCacheService = redisCacheService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteCacheByJobGroupIdAsync(Guid jobGroupId)
|
public async Task DeleteCacheAsync(Guid id, SyncTaskEntityTypeEnum type)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var key = GetKey(id, type);
|
||||||
|
|
||||||
|
await redisCacheService.DeleteCachedDataAsync(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task DeleteCacheByJobIdAsync(Guid jobId)
|
|
||||||
|
public async Task<MatchingStatus?> GetDataAsync(Guid id, SyncTaskEntityTypeEnum type)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var key = GetKey(id, type);
|
||||||
|
|
||||||
|
return await redisCacheService.GetCachedDataAsync<MatchingStatus>(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<MatchingStatus?> GetDataByJobGroupIdAsync(Guid jobGroupId)
|
|
||||||
|
public async Task SetCacheAsync(Guid id, SyncTaskEntityTypeEnum type, MatchingStatusDto data, TimeSpan cacheDuration)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var key = GetKey(id, type);
|
||||||
|
|
||||||
|
await redisCacheService.SetCachedDataAsync(key, data, cacheDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<MatchingStatus?> GetDataByJobIdAsync(Guid jobId)
|
|
||||||
|
private string GetKey(Guid id, SyncTaskEntityTypeEnum type)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
var typeStr = "";
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SyncTaskEntityTypeEnum.Job:
|
||||||
|
typeStr = "j";
|
||||||
|
break;
|
||||||
|
case SyncTaskEntityTypeEnum.JobGroup:
|
||||||
|
typeStr = "g";
|
||||||
|
break;
|
||||||
|
case SyncTaskEntityTypeEnum.Template:
|
||||||
|
typeStr = "t";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return redisCacheService.GetKey(new string[] { "ms", typeStr, id.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task SetCahcheByJobGroupIdAsync(Guid jobGroupId, MatchingStatusDto data)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task SetCahcheByJobIdAsync(Guid jobId, MatchingStatusDto data)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
using PARR.DAL.Cache.Models;
|
using PARR.Constants;
|
||||||
|
using PARR.DAL.Cache.Models;
|
||||||
|
|
||||||
namespace PARR.DAL.Cache.Services
|
namespace PARR.DAL.Cache.Services
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Сервис - статус matching`a
|
||||||
|
/// </summary>
|
||||||
public interface ICacheMatchingStatusService
|
public interface ICacheMatchingStatusService
|
||||||
{
|
{
|
||||||
Task<MatchingStatus?> GetDataByJobIdAsync(Guid jobId);
|
Task<MatchingStatus?> GetDataAsync(Guid id, SyncTaskEntityTypeEnum type);
|
||||||
|
|
||||||
Task<MatchingStatus?> GetDataByJobGroupIdAsync(Guid jobGroupId);
|
Task SetCacheAsync(Guid id, SyncTaskEntityTypeEnum type, MatchingStatusDto data, TimeSpan cacheDuration);
|
||||||
|
|
||||||
Task SetCahcheByJobIdAsync(Guid jobId, MatchingStatusDto data);
|
Task DeleteCacheAsync(Guid id, SyncTaskEntityTypeEnum type);
|
||||||
|
|
||||||
Task SetCahcheByJobGroupIdAsync(Guid jobGroupId, MatchingStatusDto data);
|
|
||||||
|
|
||||||
Task DeleteCacheByJobIdAsync(Guid jobId);
|
|
||||||
|
|
||||||
Task DeleteCacheByJobGroupIdAsync(Guid jobGroupId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user