Ledon.Idempotency 0.0.1

dotnet add package Ledon.Idempotency --version 0.0.1
                    
NuGet\Install-Package Ledon.Idempotency -Version 0.0.1
                    
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="Ledon.Idempotency" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ledon.Idempotency" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Ledon.Idempotency" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Ledon.Idempotency --version 0.0.1
                    
#r "nuget: Ledon.Idempotency, 0.0.1"
                    
#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.
#:package Ledon.Idempotency@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Ledon.Idempotency&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Ledon.Idempotency&version=0.0.1
                    
Install as a Cake Tool

Ledon.Idempotency

增强版幂等:Idempotency-Key + 请求指纹 + 响应重放 + 同键冲突 + 多实例锁。

builder.Services.AddLedonIdempotency(o =>
{
    o.Ttl = TimeSpan.FromHours(24);
    o.MaxRequestBodyBytes = 1024 * 1024;
});

app.UseRouting();
app.UseLedonIdempotency();     // 路由之后、端点之前

客户端:

POST /api/orders
Idempotency-Key: 3f1c...
Content-Type: application/json
  • 同键 + 同请求指纹:重放首次 2xx 响应,带 Idempotency-Replayed: true;
  • 同键 + 不同请求体/查询串:返回 409 + Idempotency-Conflict: true;
  • 同键并发:进程内单飞;注册 IDistributedLock(Redis)后支持多实例去重;
  • 默认使用内存存储;注册 IDistributedCache 后自动切换为分布式响应缓存;
  • 默认缓存 2xx,失败不占用键;请求/响应体可配置上限;
  • 默认按 X-Tenant-Id + 用户 ID 分区,避免跨租户/用户撞键。

已开启 LedonWebOptions.UseIdempotency 时请关闭它,避免两个幂等中间件重复处理。

完整文档:https://github.com/wosledon/ledon-framework

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.0.1 45 10/28/2026