feat(dal): IRedisCacheService
This commit is contained in:
@@ -48,6 +48,8 @@ namespace PARR.API.Contracts.V1
|
||||
|
||||
public const string GetNextSchedule = Base + "/tests/next-schedule/" + paramApplicationInWorkId + "/" + paramDate;
|
||||
|
||||
public const string CreateCache = Base + "/tests/cache/";
|
||||
|
||||
public const string paramDate = "{lastRunDate}";
|
||||
public const string paramApplicationInWorkId = "{applicationInWorkId}";
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using PARR.API.Contracts.V1;
|
||||
using PARR.API.Contracts.V1.Responses.Base;
|
||||
using PARR.API.Controllers.V1.Base;
|
||||
using PARR.API.Services.Interfaces;
|
||||
using PARR.DAL.CacheServices;
|
||||
using PARR.DAL.TransformServices;
|
||||
|
||||
namespace PARR.API.Controllers.V1
|
||||
@@ -11,11 +12,13 @@ namespace PARR.API.Controllers.V1
|
||||
{
|
||||
private readonly IClientService clientService;
|
||||
private readonly IEsppScheduleTransformService esppScheduleTransformService;
|
||||
private readonly IRedisCacheService redisCacheService;
|
||||
|
||||
public TestController(IClientService clientService, IEsppScheduleTransformService esppScheduleTransformService)
|
||||
public TestController(IClientService clientService, IEsppScheduleTransformService esppScheduleTransformService, IRedisCacheService redisCacheService)
|
||||
{
|
||||
this.clientService = clientService;
|
||||
this.esppScheduleTransformService = esppScheduleTransformService;
|
||||
this.redisCacheService = redisCacheService;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,5 +65,25 @@ namespace PARR.API.Controllers.V1
|
||||
var result = await esppScheduleTransformService.GetNextScheduleAsync(applicationInWorkId, lastRunDate);
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost(ApiRoutes.Test.CreateCache)]
|
||||
public async Task<IActionResult> CreateCache([FromBody] CaheRequestTest request)
|
||||
{
|
||||
await redisCacheService.SetCachedDataAsync(request.Key, request, TimeSpan.FromMinutes(1));
|
||||
|
||||
var fromCache = await redisCacheService.GetCachedDataAsync<CaheRequestTest>(request.Key);
|
||||
|
||||
return Ok(new { fromCache });
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class CaheRequestTest
|
||||
{
|
||||
public required string Key { get; set; }
|
||||
|
||||
public required string Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"RedisConnection": "10.99.253.216:6379"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;"
|
||||
"DefaultConnection": "Server=10.99.253.184;Database=parr;User Id=app_parr; Password=PosdfkhT&)%sdfligL&%5546;",
|
||||
"RedisConnection": "parr-redis:6379"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
|
||||
Reference in New Issue
Block a user