JiShe.IOT.Admin/src/JiShe.IoT.Application/Jobs/CacheFocusDataToRedisJob.cs

38 lines
1.1 KiB
C#
Raw Normal View History

using JiShe.ServicePro.Core;
using JiShe.ServicePro.DeviceManagement.Focuses;
using JiShe.ServicePro.DeviceManagement.Meters;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.IoT.Jobs
{
/// <summary>
/// 缓存集中器数据到Redis
/// </summary>
public class CacheFocusDataToRedisJob : SystemBackGroundWorkService
{
private readonly ILogger<CacheFocusDataToRedisJob> _logger;
public readonly FocusAppService _focusAppService;
public CacheFocusDataToRedisJob(ILogger<CacheFocusDataToRedisJob> logger, FocusAppService focusAppService) : base(logger)
{
_logger = logger;
_focusAppService= focusAppService;
}
protected override Task DoWorkAsync(CancellationToken cancellationToken)
{
return _focusAppService.CacheFocusDataToRedisAsync();
}
protected override TimeSpan GetInterval()
{
return TimeSpan.FromHours(1);
}
}
}