Cache cleanup implemented

This commit is contained in:
Joseph Milazzo 2021-01-11 15:39:25 -06:00
parent f737f662df
commit 731e3a9c5e
11 changed files with 132 additions and 29 deletions

View file

@ -1,15 +1,21 @@
using API.Interfaces;
using Hangfire;
using Microsoft.Extensions.Logging;
namespace API.Services
{
public class TaskScheduler : ITaskScheduler
{
private readonly ILogger<TaskScheduler> _logger;
private readonly BackgroundJobServer _client;
public TaskScheduler()
public TaskScheduler(ICacheService cacheService, ILogger<TaskScheduler> logger)
{
_logger = logger;
_client = new BackgroundJobServer();
_logger.LogInformation("Scheduling/Updating cache cleanup on a daily basis.");
RecurringJob.AddOrUpdate(() => cacheService.Cleanup(), Cron.Daily);
}