IdempotencyGuard 1.3.0
dotnet add package IdempotencyGuard --version 1.3.0
NuGet\Install-Package IdempotencyGuard -Version 1.3.0
<PackageReference Include="IdempotencyGuard" Version="1.3.0" />
<PackageVersion Include="IdempotencyGuard" Version="1.3.0" />
<PackageReference Include="IdempotencyGuard" />
paket add IdempotencyGuard --version 1.3.0
#r "nuget: IdempotencyGuard, 1.3.0"
#:package IdempotencyGuard@1.3.0
#addin nuget:?package=IdempotencyGuard&version=1.3.0
#tool nuget:?package=IdempotencyGuard&version=1.3.0
IdempotencyGuard
Core abstractions and in-memory store for the IdempotencyGuard library. This package provides the foundational types, interfaces, and an in-memory store implementation for idempotent HTTP API request handling.
What's in this package
IIdempotencyStore— store interface for claim/response lifecycleIPurgableIdempotencyStore— extension interface for stores that support expired entry cleanupIDownstreamKeyGenerator/IIdempotencyContext— deterministic key generation for downstream service callsInMemoryIdempotencyStore— in-memory store for development and testingRequestFingerprint— SHA256-based request fingerprinting with JSON normalisationIdempotencyOptions— full configuration model- Built-in metrics via
System.Diagnostics.Metricsunder theIdempotencyGuardmeter
When to use this package directly
Most applications should install IdempotencyGuard.AspNetCore instead, which includes this package as a dependency and adds the ASP.NET Core middleware.
Install this package directly if you are:
- Building a custom store implementation
- Using the fingerprinting or key generation utilities outside of ASP.NET Core
- Writing a non-ASP.NET Core host that needs the core abstractions
Installation
dotnet add package IdempotencyGuard
Implementing a custom store
public class MyCustomStore : IIdempotencyStore
{
public Task<ClaimResult> TryClaimAsync(string key, string fingerprint, TimeSpan claimTtl, CancellationToken ct = default)
{
// Atomically claim the key or return the existing state
}
public Task SetResponseAsync(string key, IdempotentResponse response, TimeSpan responseTtl, CancellationToken ct = default)
{
// Store the response for replay
}
public Task<IdempotentResponse?> GetResponseAsync(string key, CancellationToken ct = default)
{
// Retrieve a cached response
}
public Task ReleaseClaimAsync(string key, CancellationToken ct = default)
{
// Release a claim after processing failure
}
}
Available store packages
| Store | Package |
|---|---|
| Redis | IdempotencyGuard.Redis |
| PostgreSQL | IdempotencyGuard.PostgreSql |
| SQL Server | IdempotencyGuard.SqlServer |
Documentation
See the full documentation on GitHub for configuration, usage guides, and examples.
License
MIT
| 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 is compatible. 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
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on IdempotencyGuard:
| Package | Downloads |
|---|---|
|
IdempotencyGuard.Redis
Redis-backed idempotency store with atomic Lua scripts for IdempotencyGuard. Provides distributed claim coordination and response caching via StackExchange.Redis. |
|
|
IdempotencyGuard.AspNetCore
ASP.NET Core middleware for automatic idempotent request handling. Provides Idempotency-Key header processing, request fingerprinting, response caching and replay, and per-endpoint configuration via attributes. |
|
|
IdempotencyGuard.PostgreSql
PostgreSQL-backed idempotency store using INSERT ON CONFLICT for IdempotencyGuard. Provides durable claim coordination and response caching with automatic schema provisioning. |
|
|
IdempotencyGuard.SqlServer
SQL Server-backed idempotency store using MERGE for IdempotencyGuard. Provides durable claim coordination and response caching with automatic schema provisioning. |
GitHub repositories
This package is not used by any popular GitHub repositories.