Yoko.Hangfire.Redis
1.0.3.4
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.7.2
This package targets .NET Framework 4.7.2. The package is compatible with this framework or higher.
dotnet add package Yoko.Hangfire.Redis --version 1.0.3.4
NuGet\Install-Package Yoko.Hangfire.Redis -Version 1.0.3.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Yoko.Hangfire.Redis" Version="1.0.3.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yoko.Hangfire.Redis --version 1.0.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Yoko.Hangfire.Redis, 1.0.3.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Yoko.Hangfire.Redis as a Cake Addin #addin nuget:?package=Yoko.Hangfire.Redis&version=1.0.3.4 // Install Yoko.Hangfire.Redis as a Cake Tool #tool nuget:?package=Yoko.Hangfire.Redis&version=1.0.3.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Yoko.Hangfire.Redis
🔍 Hangfire的Redis持久化Job插件,支持自定义仪表盘Title
🔍 最低 NET Framework 4.7.2 / NET Standard 2.0
💎 参考配置(Net5)
1、Startup
public static ConnectionMultiplexer Redis;
public Startup(IConfiguration configuration)
{
Configuration = configuration;
Redis = ConnectionMultiplexer.Connect(Configuration.GetConnectionString("Redis"));
}
2、appsettings.json
"ConnectionStrings": {
"Redis": "127.0.0.1:6379"
}
3、Startup.ConfigureServices
//=========================WebApi===========================
//在.NETCore3.0+后WebApi控制器使用dynamic,object类型接受传值,
//后台接收到的参数中会包含一个ValueKind的属性,包含ValueKind属性会影响取参的便捷性
//所以将对象序列化程序改为NewtonsoftJson便可正常取值
//services.AddControllers().AddNewtonsoftJson(options =>
//{
// options.SerializerSettings.ContractResolver = new DefaultContractResolver();
//});
//==========================================================
//Hangfire
services.AddHangfire(configuration =>
{
configuration.UseRedisStorage(Redis, new RedisStorageOptions()
{
FetchTimeout = TimeSpan.FromMinutes(5),
Db = 1,
Prefix = "{APiServer}:",
//活动服务器超时时间
InvisibilityTimeout = TimeSpan.FromHours(1),
//任务过期检查频率
ExpiryCheckInterval = TimeSpan.FromHours(1),
DeletedListSize = 10000,
SucceededListSize = 10000
})
.UseHangfireDashboard(new JobDashboardOptions()
{
DashboardTitle = "API任务调度管理系统",
DashboardName = "API任务调度管理系统",
DashboardFooter = "API任务调度管理系统 V1.0.0"
})
//.UseConsole(new ConsoleOptions()
//{
// BackgroundColor = "#000079"
//})
.UseDashboardMetric(DashboardMetrics.AwaitingCount)
.UseDashboardMetric(DashboardMetrics.ProcessingCount)
.UseDashboardMetric(DashboardMetrics.RecurringJobCount)
.UseDashboardMetric(DashboardMetrics.RetriesCount)
.UseDashboardMetric(DashboardMetrics.FailedCount)
.UseDashboardMetric(DashboardMetrics.SucceededCount);
});
//IHostedService
services.AddHangfireServer(options =>
{
options.ServerTimeout = TimeSpan.FromMinutes(4);
options.SchedulePollingInterval = TimeSpan.FromSeconds(1);//秒级任务需要配置短点,一般任务可以配置默认时间,默认15秒
options.ShutdownTimeout = TimeSpan.FromMinutes(30);//超时时间
options.Queues = new[] { "testjob", "apis", "default" };//默认队列
options.WorkerCount = Math.Max(Environment.ProcessorCount, 40);//工作线程数,当前允许的最大线程,默认20
});
4、Startup.ConfigureServices
//只读面板
app.UseHangfireDashboard("/hangfire-read", new DashboardOptions
{
AppPath = "#",
DisplayStorageConnectionString = false,
IsReadOnlyFunc = Context =>
{
return false;
}
});
app.UseEndpoints(endpoints =>
{
endpoints.MapHangfireDashboard();
});
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. |
.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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.7.2
- HangFire.Core (>= 1.7.25)
- StackExchange.Redis (>= 2.2.79)
-
.NETStandard 2.0
- HangFire.Core (>= 1.7.25)
- StackExchange.Redis (>= 2.2.79)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.