Skip to content

feat: Add NetEvolve.Pulse.Redis with RedisIdempotencyStore#429

Open
Copilot wants to merge 1 commit intomainfrom
copilot/create-netevolve-pulse-redis-project
Open

feat: Add NetEvolve.Pulse.Redis with RedisIdempotencyStore#429
Copilot wants to merge 1 commit intomainfrom
copilot/create-netevolve-pulse-redis-project

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 18, 2026

Adds a Redis-backed idempotency provider using StackExchange.Redis atomic SET NX EX operations, eliminating the read-before-write round-trip inherent in SQL-based stores.

New project: NetEvolve.Pulse.Redis

  • RedisIdempotencyKeyOptionsKeyPrefix ("pulse:idempotency:"), TimeToLive (24h), Database (-1)
  • RedisIdempotencyKeyOptionsValidator — rejects TimeToLive <= Zero and empty/whitespace KeyPrefix; registered with ValidateOnStart()
  • RedisIdempotencyKeyOptionsConfiguration — binds from Pulse:Idempotency:Redis config section; gracefully no-ops when IConfiguration is not registered
  • RedisIdempotencyStore : IIdempotencyStore — directly implements IIdempotencyStore (bypasses the IIdempotencyKeyRepository layer); ExistsAsyncKeyExistsAsync; StoreAsyncStringSetAsync(..., When.NotExists), silently succeeds on duplicate
  • AddRedisIdempotencyStore — replaces the default IIdempotencyStore registration with RedisIdempotencyStore (Scoped); IConnectionMultiplexer must be registered by the caller
// Register IConnectionMultiplexer first
services.AddSingleton<IConnectionMultiplexer>(_ =>
    ConnectionMultiplexer.Connect("localhost:6379"));

services.AddPulse(config => config
    .AddRedisIdempotencyStore(opts =>
    {
        opts.KeyPrefix = "myapp:idempotency:";
        opts.TimeToLive = TimeSpan.FromHours(48);
    })
);

Test coverage

Unit tests cover constructor validation, argument guards, ExistsAsync true/false propagation, and StoreAsync no-throw on duplicate. Added <NoWarn>SER002;SER003;SER006</NoWarn> to the unit test project to suppress StackExchange.Redis experimental-API diagnostics emitted by the TUnit.Mocks source generator.

Copilot AI linked an issue Apr 18, 2026 that may be closed by this pull request
5 tasks
Copilot AI changed the title [WIP] Create NetEvolve.Pulse.Redis project with RedisIdempotencyStore feat: Add NetEvolve.Pulse.Redis with RedisIdempotencyStore Apr 18, 2026
Copilot AI requested a review from samtrion April 18, 2026 08:41
@samtrion samtrion marked this pull request as ready for review April 18, 2026 10:53
@samtrion samtrion requested a review from a team as a code owner April 18, 2026 10:53
@samtrion samtrion force-pushed the copilot/create-netevolve-pulse-redis-project branch from bef1ebe to baee86c Compare April 18, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Create NetEvolve.Pulse.Redis project with RedisIdempotencyStore

2 participants