Class InMemoryIdempotencyStore
- Namespace
- PatternKit.Messaging.Reliability
- Assembly
- PatternKit.Core.dll
Thread-safe in-memory idempotency store for tests, demos, and single-process applications.
public sealed class InMemoryIdempotencyStore : IIdempotencyStore
- Inheritance
-
InMemoryIdempotencyStore
- Implements
- Inherited Members
Properties
Count
The number of keys stored.
public int Count { get; }
Property Value
Methods
MarkCompletedAsync(string, object?, CancellationToken)
Marks a claimed key as completed and stores an optional replayable result.
public ValueTask MarkCompletedAsync(string key, object? result = null, CancellationToken cancellationToken = default)
Parameters
keystringresultobjectcancellationTokenCancellationToken
Returns
MarkFailedAsync(string, string?, CancellationToken)
Marks a claimed key as failed with an optional reason.
public ValueTask MarkFailedAsync(string key, string? reason = null, CancellationToken cancellationToken = default)
Parameters
keystringreasonstringcancellationTokenCancellationToken
Returns
TryClaimAsync(string, CancellationToken)
Attempts to claim key for processing.
public ValueTask<IdempotencyClaim> TryClaimAsync(string key, CancellationToken cancellationToken = default)
Parameters
keystringcancellationTokenCancellationToken
Returns
TryGet(string, out IdempotencyClaim?)
Attempts to read the current stored claim for a key.
public bool TryGet(string key, out IdempotencyClaim? claim)
Parameters
keystringclaimIdempotencyClaim