using Coravel; using Coravel.Scheduling.Schedule; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using VideoAnalysisCore.Job; namespace Learn.VideoAnalysis.Expand { public static class CoravelExpand { public static void AddCoravel(this IServiceCollection service) { Console.WriteLine($"{DateTime.Now}=>初始化 Coravel"); service.AddScheduler(); #if !DEBUG service.AddTransient(); #endif service.AddTransient(); service.AddTransient(); } public static void UseCoravelExpand(this IApplicationBuilder provider) { provider.ApplicationServices.UseScheduler(scheduler => { //任务缓存清理 // scheduler.Schedule().HourlyAt(10); //强制清理所有缓存内容 //scheduler.Schedule().Hourly(); scheduler.Schedule().EverySeconds(40); }); } } }