NICWebApi.Extensions.Idempotency 1.0.41

dotnet add package NICWebApi.Extensions.Idempotency --version 1.0.41
                    
NuGet\Install-Package NICWebApi.Extensions.Idempotency -Version 1.0.41
                    
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="NICWebApi.Extensions.Idempotency" Version="1.0.41" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NICWebApi.Extensions.Idempotency" Version="1.0.41" />
                    
Directory.Packages.props
<PackageReference Include="NICWebApi.Extensions.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 NICWebApi.Extensions.Idempotency --version 1.0.41
                    
#r "nuget: NICWebApi.Extensions.Idempotency, 1.0.41"
                    
#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 NICWebApi.Extensions.Idempotency@1.0.41
                    
#: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=NICWebApi.Extensions.Idempotency&version=1.0.41
                    
Install as a Cake Addin
#tool nuget:?package=NICWebApi.Extensions.Idempotency&version=1.0.41
                    
Install as a Cake Tool

NICWebApi.Extensions.Idempotency

幂等请求扩展包。默认使用内存存储 Idempotency-Key,适合单实例和开发环境;多实例生产环境建议启用 Redis 存储。

使用

builder.Services.AddIdempotency();

[HttpPost]
[Idempotent]
public Task CreateOrder(CreateOrderInput input)
{
    return orderService.CreateAsync(input);
}

启用 Redis:

builder.Services.AddIdempotency(options => options.UseRedis("localhost:6379"));

请求头:

Idempotency-Key: order-1001

默认幂等范围为 HTTP 方法 + Path + Idempotency-Key

配置

{
  "Idempotency": {
    "HeaderName": "Idempotency-Key",
    "Expiration": "00:10:00",
    "KeyPrefix": "idempotency",
    "Redis": {
      "Enabled": false,
      "Configuration": "localhost:6379"
    }
  }
}

Redis.Enabled 默认是 false。启用后会使用 Redis SET NX 原子写入,避免多实例并发重复提交。

更多配置边界见 ../docs/Configuration.md

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

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NICWebApi.Extensions.Idempotency:

Package Downloads
NICWebApi.Extensions.AspNetCore

NICWebApi ASP.NET Core 一键集成扩展包,组合 DynamicAPI、RESTfulResult、JWT、Mapper、DependencyInjection、Http、RemoteRequest、Caching、Idempotency、Schedule、Messaging 和 OperationLogging 的默认注册。

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.41 147 7/7/2026