Soenneker.Hangfire.Redis.Util
11.0.384
Prefix Reserved
dotnet add package Soenneker.Hangfire.Redis.Util --version 11.0.384
NuGet\Install-Package Soenneker.Hangfire.Redis.Util -Version 11.0.384
<PackageReference Include="Soenneker.Hangfire.Redis.Util" Version="11.0.384" />
<PackageVersion Include="Soenneker.Hangfire.Redis.Util" Version="11.0.384" />
<PackageReference Include="Soenneker.Hangfire.Redis.Util" />
paket add Soenneker.Hangfire.Redis.Util --version 11.0.384
#r "nuget: Soenneker.Hangfire.Redis.Util, 11.0.384"
#:package Soenneker.Hangfire.Redis.Util@11.0.384
#addin nuget:?package=Soenneker.Hangfire.Redis.Util&version=11.0.384
#tool nuget:?package=Soenneker.Hangfire.Redis.Util&version=11.0.384
We recommend Flywheel for background jobs due to our concerns about Hangfire's approach to community collaboration and addressing security vulnerabilities.
These libraries will no longer receive new features. Dependencies will continue to be updated.
Soenneker.Hangfire.Redis.Util
Provides destructive maintenance operations for removing Hangfire background-job data directly from Redis while preserving selected jobs and Hangfire infrastructure metadata.
Installation
dotnet add package Soenneker.Hangfire.Redis.Util
Configuration and registration
{
"Redis": {
"ConnectionString": "redis.example.com:6379,password=..."
}
}
using Soenneker.Hangfire.Redis.Util.Registrars;
services.AddHangfireRedisUtilAsScoped();
The scoped utility uses the long-lived Redis connections registered by the underlying Redis packages; disposing the utility scope does not tear down the shared connection.
Delete jobs while preserving specific IDs
using Soenneker.Hangfire.Redis.Util.Abstract;
long deletedKeyCount = await redisUtil.DeleteAllJobsExcept(
prefix: "{hangfire}:",
preservedJobIds: [importantJobId, anotherJobId],
batchSize: 500,
cancellationToken);
The prefix must exactly match the prefix configured for Hangfire Redis storage, including its trailing separator. The method removes non-preserved job: and console: keys and removes non-preserved entries from succeeded, deleted, processing, failed, awaiting, scheduled, and queue indexes. Recurring-job definitions, queue metadata, locks, and server metadata are retained.
To remove every background job without preserving IDs:
await redisUtil.DeleteAllHangfireKeysSafe("{hangfire}:", cancellationToken);
“Safe” means Hangfire infrastructure metadata is retained; the operation still permanently deletes all job data. Stop or quiesce Hangfire workers before running either method. Cleanup spans multiple Redis keys and is not one atomic transaction, so cancellation or a Redis failure can leave a partially cleaned data set. Back up production Redis data and verify the prefix before use.
DeleteAllJobsExcept() returns only the number of per-job and console keys deleted; removed index entries are not included in that count.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Redis.Util.Server (>= 11.0.3223)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.384 | 0 | 11/15/2026 |
| 11.0.383 | 48 | 11/13/2026 |
| 11.0.382 | 77 | 11/11/2026 |
| 11.0.381 | 76 | 11/11/2026 |
| 11.0.380 | 79 | 11/11/2026 |
| 11.0.379 | 83 | 11/11/2026 |
| 11.0.378 | 77 | 11/11/2026 |
| 11.0.377 | 80 | 11/11/2026 |
| 11.0.376 | 77 | 11/11/2026 |
| 11.0.375 | 87 | 11/3/2026 |
| 11.0.374 | 93 | 11/3/2026 |
| 11.0.373 | 91 | 11/3/2026 |
| 11.0.372 | 96 | 11/3/2026 |
| 11.0.371 | 93 | 11/3/2026 |
| 11.0.370 | 86 | 11/3/2026 |
| 11.0.369 | 95 | 11/3/2026 |
| 11.0.368 | 94 | 11/3/2026 |
| 11.0.367 | 96 | 11/2/2026 |
| 11.0.366 | 100 | 10/31/2026 |
| 11.0.365 | 101 | 10/29/2026 |
Update dependency Soenneker.Redis.Util.Server to 11.0.3223 (#634)