Healthie.NET.Redis
4.1.0
Prefix Reserved
dotnet add package Healthie.NET.Redis --version 4.1.0
NuGet\Install-Package Healthie.NET.Redis -Version 4.1.0
<PackageReference Include="Healthie.NET.Redis" Version="4.1.0" />
<PackageVersion Include="Healthie.NET.Redis" Version="4.1.0" />
<PackageReference Include="Healthie.NET.Redis" />
paket add Healthie.NET.Redis --version 4.1.0
#r "nuget: Healthie.NET.Redis, 4.1.0"
#:package Healthie.NET.Redis@4.1.0
#addin nuget:?package=Healthie.NET.Redis&version=4.1.0
#tool nuget:?package=Healthie.NET.Redis&version=4.1.0
Healthie.NET.Redis
Redis state provider for Healthie.NET.
State is written on every tick of every checker. A relational provider does a round trip to a disk-backed engine for each of those; this does one to memory. That is the whole reason to pick it.
Installation
dotnet add package Healthie.NET.Redis
Usage
using Healthie.StateProviding.Redis;
builder.Services
.AddHealthie(typeof(Program).Assembly)
.AddHealthieRedis("localhost:6379");
If your application already registers an IConnectionMultiplexer — for its own cache, or through AddStackExchangeRedisCache — share it instead of opening a second connection to the same server:
builder.Services.AddHealthieRedis(); // uses the registered IConnectionMultiplexer
Both shapes are the same method: pass a configuration string to have the connection opened for you, or leave it out to use the registered one. Name the argument when you only want a different prefix — AddHealthieRedis(keyPrefix: "myapp:health:").
Every key is prefixed, healthie:state: by default, so the provider stays out of the way of whatever else lives on that server. Pass your own as the last argument.
Optimistic concurrency
SupportsOptimisticConcurrency is true. A write can be made conditional on the state not having changed since it was read, which is what stops a check overwriting a setting somebody changed from the dashboard.
The compare and the write are a Lua script, which Redis runs to completion without interleaving anything else:
if redis.call('HGET', KEYS[1], 'version') ~= ARGV[3] then
return 0
end
redis.call('HSET', KEYS[1], 'value', ARGV[1], 'state_type', ARGV[2], 'version', ARGV[4])
return 1
A WATCH/MULTI/EXEC transaction would also work, but it needs a retry loop of its own around the optimistic failure, and it holds state on the connection. A script needs neither.
Creating is the same shape against EXISTS, so two writers that both find nothing cannot both create — the case where there is no version to compare and a lost update would otherwise slip through.
How it works
- One hash per checker, at
{prefix}{checkerName}, holdingvalue(the state as JSON),state_type, andversion. A hash rather than a plain string so the version can be swapped in the same command as the write. GetStatesAsyncissues every read before awaiting any. StackExchange.Redis pipelines on one connection, so listing every checker on the dashboard costs one round trip rather than one per checker.- Each hash records the type its state was written as, and reading it as a different type throws rather than returning a mismatched state. The comparison is on
Type.FullName, not the assembly-qualified name — that embeds the assembly version, and this library's version changes with every release, so comparing it would make state written by one release unreadable by the next. - A hash written before this provider versioned its writes has no
versionfield. It reports as unversioned, and a caller writes it unconditionally exactly as it did before; the next write gives it one.
Durability is Redis's, not this package's
Redis is in memory. Whether state survives a restart is your Redis configuration — RDB snapshots, AOF, or a managed offering's own guarantees — not something this provider can promise. For pulse checker state that is usually the right trade: the interesting state is the current one, and a lost history is a gap in a chart rather than an outage. If it is not the right trade for you, use PostgreSQL, SQL Server or CosmosDB.
See also
- Healthie.NET — the metapackage
- Healthie.NET.Postgres / Healthie.NET.SqlServer / Healthie.NET.CosmosDb — the durable-by-default alternatives
| 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 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. |
-
net10.0
- Healthie.NET.Abstractions (>= 4.1.0)
- StackExchange.Redis (>= 3.0.25)
-
net8.0
- Healthie.NET.Abstractions (>= 4.1.0)
- StackExchange.Redis (>= 3.0.25)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Twenty packages was too many, and two of them had no business being separate. This release fixes
that without breaking anything: **an application on 4.0.0 upgrades by changing nothing.**
### Added
- **`Healthie.NET`**, the package to install first. It carries no code of its own, only a dependency
on `Healthie.NET.DependencyInjection`, so it is one install and one dependency rather than a
bundle -- no provider, scheduler or UI framework arrives with it. The name people guess did not
exist before, and the actual entry point was called `DependencyInjection`, which reads like
plumbing rather than the way in.
- **Uptime reporting and leader election are in the core package.** `AddHealthieUptime()` and
`AddHealthieLeaderElection()` need nothing else installed. Both stay opt-in: nothing runs until
you call them.
### Deprecated
- **`Healthie.NET.Uptime`** and **`Healthie.NET.LeaderElection`**. Neither carried a third-party
dependency, so keeping them separate cost two installs and saved nothing -- the provider packages
exist to keep Npgsql or Temporalio off machines that do not use them, and these two were not
providers.
**Nothing breaks.** Both packages are still published, now as assemblies of type forwards, so an
application that references either keeps compiling *and* keeps running untouched. That is what
makes this a minor release: moving a type between assemblies is a binary break the compiler cannot
see, because source keeps building and only the runtime finds out. Remove the reference whenever it
suits you; neither package will gain features.
### Fixed
- **The sample Dockerfiles took their .NET base images by mutable tag.** A tag is a different image
next week, so the build that passed review is not the build that ships. Both are pinned by digest,
which Dependabot updates the way it updates a package version. Closes four OpenSSF Scorecard
*Pinned-Dependencies* findings.
### Security
- **An Azure CosmosDB key committed in May 2025 was confirmed dead and the alert closed.** It had
already been removed from the working tree; the account it belonged to no longer exists in the
owning tenant, verified by enumerating every Cosmos account across that tenant's subscriptions, so
the key authenticates to nothing. It remains in history at `ee0c78e`, inert.
- **Stray screenshots can no longer be committed.** Root-level PNGs are ignored, scoped to the root
so the images the docs and samples genuinely ship are untouched.
Full changelog: https://github.com/ivanvyd/Healthie.NET/blob/v4.1.0/CHANGELOG.md