NICWebApi.Extensions.Schedule
1.0.41
dotnet add package NICWebApi.Extensions.Schedule --version 1.0.41
NuGet\Install-Package NICWebApi.Extensions.Schedule -Version 1.0.41
<PackageReference Include="NICWebApi.Extensions.Schedule" Version="1.0.41" />
<PackageVersion Include="NICWebApi.Extensions.Schedule" Version="1.0.41" />
<PackageReference Include="NICWebApi.Extensions.Schedule" />
paket add NICWebApi.Extensions.Schedule --version 1.0.41
#r "nuget: NICWebApi.Extensions.Schedule, 1.0.41"
#:package NICWebApi.Extensions.Schedule@1.0.41
#addin nuget:?package=NICWebApi.Extensions.Schedule&version=1.0.41
#tool nuget:?package=NICWebApi.Extensions.Schedule&version=1.0.41
NICWebApi.Extensions.Schedule
NICWebApi.Extensions.Schedule 是独立的轻量级定时任务扩展库,默认使用 Cronos 调度引擎,提供 Cron、固定间隔、启动立即执行、并发控制、ASP.NET Core HostedService 执行能力和内置任务看板。
它不负责动态 API、统一返回格式、远程 HTTP 请求、JWT 认证、Swagger UI 或持久化任务。任务看板只展示和控制本模块任务,认证授权交给 ASP.NET Core 管道或自定义配置处理。
数据库执行记录默认关闭,需要显式开启并注册 IScheduleExecutionRecordStore。多实例分布式锁默认关闭,需要显式启用 Redis。
快速开始
builder.Services.AddSchedule();
builder.Services.AddCronJob<CleanupJob>("cleanup", "0 */5 * * * *");
默认看板入口:
app.UseScheduleUI();
浏览器打开 /schedule 即可查看任务、暂停/恢复任务或手动触发任务。
运行时快捷控制:
using NICWebApi.Extensions.Schedule.Extensions;
await "cleanup".TriggerScheduleAsync(scheduleManager);
"cleanup".PauseSchedule(scheduleManager);
"cleanup".ResumeSchedule(scheduleManager);
var snapshot = "cleanup".GetScheduleSnapshot(scheduleManager);
数据库执行记录按需开启:
builder.Services.AddSchedule(options =>
{
options.ExecutionRecords.Enabled = true;
});
builder.Services.AddScoped<IScheduleExecutionRecordStore, EfCoreScheduleExecutionRecordStore>();
Redis 分布式锁按需开启:
builder.Services.AddSchedule(options => options.UseRedis("localhost:6379", "my-api:schedule:"));
using NICWebApi.Extensions.Schedule.Abstractions;
using NICWebApi.Extensions.Schedule.Models;
public sealed class CleanupJob : IScheduledJob
{
public Task ExecuteAsync(ScheduleExecutionContext context, CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}
固定间隔任务:
builder.Services.AddIntervalJob<ReportJob>("report", TimeSpan.FromMinutes(10), options =>
{
options.RunOnStart = true;
options.AllowConcurrentExecutions = false;
});
更多内容:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Cronos (>= 0.13.0)
- StackExchange.Redis (>= 2.8.37)
-
net8.0
- Cronos (>= 0.13.0)
- StackExchange.Redis (>= 2.8.37)
-
net9.0
- Cronos (>= 0.13.0)
- StackExchange.Redis (>= 2.8.37)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Schedule:
| Package | Downloads |
|---|---|
|
NICWebApi.Extensions.AspNetCore
NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.41 | 149 | 7/7/2026 |