Lyo.Scheduler
1.0.0
dotnet add package Lyo.Scheduler --version 1.0.0
NuGet\Install-Package Lyo.Scheduler -Version 1.0.0
<PackageReference Include="Lyo.Scheduler" Version="1.0.0" />
<PackageVersion Include="Lyo.Scheduler" Version="1.0.0" />
<PackageReference Include="Lyo.Scheduler" />
paket add Lyo.Scheduler --version 1.0.0
#r "nuget: Lyo.Scheduler, 1.0.0"
#:package Lyo.Scheduler@1.0.0
#addin nuget:?package=Lyo.Scheduler&version=1.0.0
#tool nuget:?package=Lyo.Scheduler&version=1.0.0
Lyo.Scheduler
In-process scheduler service for executing actions at scheduled times. Supports SetTimes, Interval, OneShot, and Cron schedules (5- or 6-field expressions) with logging, metrics, and optional state persistence via ISchedulerStateStore.
Features
- Schedule types –
SetTimes(specific daily times),Interval(periodic within a window),OneShot(single run),Cron(full cron expressions viaLyo.Schedule.Models.CronExpression) - State persistence – In-memory by default; pluggable
ISchedulerStateStore(e.g. cache-backed) for cross-restart persistence - Logging and metrics – Built-in
IMetricsandILoggerintegration - Background execution – Actions run in background by default; optional action timeout
Examples
Usage
using Lyo.Scheduler;
using Lyo.Schedule.Models;
// Add to DI (in-memory state store)
services.AddScheduler();
// Or with custom options
services.AddScheduler(options =>
{
options.CheckIntervalMs = 5_000;
options.ActionTimeout = TimeSpan.FromMinutes(10);
options.RunInBackground = true;
});
// Or with a persistent state store (e.g. cache-backed)
services.AddScheduler(myStateStore);
// Add schedules and start
var scheduler = app.Services.GetRequiredService<ISchedulerService>();
scheduler.AddSchedule(
"daily-report",
"Daily Report",
new ScheduleDefinition
{
Type = ScheduleType.SetTimes,
Times = ["09:00", "17:00"],
Timezone = "America/New_York"
},
async ct => await SendDailyReportAsync(ct));
await scheduler.StartAsync();
ISchedulerService API
| Member | Purpose |
|---|---|
AddSchedule(string id, string name, ScheduleDefinition def, Func<CancellationToken,Task> action) |
Register a scheduled action. Returns true when newly registered; false when an entry already exists for id. |
RemoveSchedule(string id) |
Remove a schedule. |
TryGetSchedule(string id, out ScheduledAction action) / GetSchedules() |
Inspection. |
StartAsync(CancellationToken) / StopAsync(CancellationToken) |
Lifecycle. |
TriggerNowAsync(string id, CancellationToken) |
Force-run an existing schedule out of cadence. |
GetNextRun(string id, DateTimeOffset? from = null) |
Next occurrence using ScheduleCalculator for all four schedule types. |
ScheduleCalculator is the underlying evaluator: it dispatches to GetNextRunSetTimes / GetNextRunInterval / GetNextRunOneShot / GetNextRunCron. Cron evaluation first tries
CronFormat.IncludeSeconds (6 fields) and falls back to the standard 5-field format.
Schedule types (Lyo.Schedule.Models)
- SetTimes – Run at specific times each day (e.g. 09:00, 17:00)
- Interval – Run every N minutes/hours within a daily window
- OneShot – Run once at a specific time
- Cron – Standard 5-field or 6-field cron (
"0 8 * * MON-FRI","*/30 * * * * *")
Configuration
| Option | Default | Description |
|---|---|---|
| CheckIntervalMs | 10000 | Interval (ms) between checks for due schedules |
| EnableMetrics | true | Enable metrics (when IMetrics registered) |
| RunInBackground | true | Run actions fire-and-forget vs await |
| ActionTimeout | 120 min | Max duration for each action; null = no timeout |
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common— (direct, lyo)Lyo.DateAndTime— (direct, lyo)Lyo.Exceptions— (direct, lyo)Lyo.Metrics— (direct, lyo)Lyo.Schedule.Models— (direct, lyo)Microsoft.Extensions.Logging.Abstractions10.0.5— (direct, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (transitive, microsoft)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Lyo.Common (>= 1.0.0)
- Lyo.DateAndTime (>= 1.0.0)
- Lyo.Exceptions (>= 1.0.0)
- Lyo.Metrics (>= 1.0.0)
- Lyo.Schedule.Models (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
-
net10.0
- Lyo.Common (>= 1.0.0)
- Lyo.DateAndTime (>= 1.0.0)
- Lyo.Exceptions (>= 1.0.0)
- Lyo.Metrics (>= 1.0.0)
- Lyo.Schedule.Models (>= 1.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Lyo.Scheduler:
| Package | Downloads |
|---|---|
|
Lyo.Job.Postgres
PostgreSQL job management data layer with EF Core, optional auto-migrations, and API endpoints for scheduling, running, and monitoring background jobs with RabbitMQ support. |
|
|
Lyo.Job.Scheduler
Job scheduling and execution service dispatching jobs via RabbitMQ message queue. |
|
|
Lyo.Schedule.Web.Components
Reusable Blazor components for building, validating, and testing schedule definitions interactively. |
|
|
Lyo.Job.Web.Components
Blazor components library for managing, monitoring, and operating Lyo jobs with MudBlazor integration. |
|
|
Lyo.Scheduler.Cache
Cache-backed state store for Lyo.Scheduler. Persists scheduler state across restarts using Lyo.Cache. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 69 | 8/16/2026 |