Table of Contents

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

int

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

key string
result object
cancellationToken CancellationToken

Returns

ValueTask

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

key string
reason string
cancellationToken CancellationToken

Returns

ValueTask

TryClaimAsync(string, CancellationToken)

Attempts to claim key for processing.

public ValueTask<IdempotencyClaim> TryClaimAsync(string key, CancellationToken cancellationToken = default)

Parameters

key string
cancellationToken CancellationToken

Returns

ValueTask<IdempotencyClaim>

TryGet(string, out IdempotencyClaim?)

Attempts to read the current stored claim for a key.

public bool TryGet(string key, out IdempotencyClaim? claim)

Parameters

key string
claim IdempotencyClaim

Returns

bool