Yoko.Hangfire.Redis
1.0.3.3
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
.NET Framework 4.6.1
This package targets .NET Framework 4.6.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Yoko.Hangfire.Redis --version 1.0.3.3
NuGet\Install-Package Yoko.Hangfire.Redis -Version 1.0.3.3
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.3" />
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.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Yoko.Hangfire.Redis, 1.0.3.3"
#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.3 // Install Yoko.Hangfire.Redis as a Cake Tool #tool nuget:?package=Yoko.Hangfire.Redis&version=1.0.3.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Hangfire使用Redis持久化Job,自定义仪表盘Title
💎 参考配置(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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.1
- 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.