Path: redb-route/redb.Route/Abstractions/IClaimCheckRepository.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/Abstractions/IClaimCheckRepository.cs
----
using System;
using System.Threading;
using System.Threading.Tasks;
namespace redb.Route.Abstractions;
///
/// Repository for the Claim Check EIP pattern.
/// Stores opaque binary data associated with a unique key.
/// Implementations may provide TTL-based auto-expiry.
///
public interface IClaimCheckRepository
{
///
/// Stores data under an auto-generated unique key.
///
/// Binary payload to store.
/// Optional time-to-live. Null uses repository default or no expiry.
/// Cancellation token.
/// Unique claim key for later retrieval.
Task Store(ReadOnlyMemory data, TimeSpan? ttl = null, CancellationToken ct = default);
///
/// Stores data under a specific key. Overwrites if key already exists.
///
/// Explicit claim key.
/// Binary payload to store.
/// Optional time-to-live. Null uses repository default or no expiry.
/// Cancellation token.
Task Store(string key, ReadOnlyMemory data, TimeSpan? ttl = null, CancellationToken ct = default);
///
/// Retrieves data by claim key without removing it.
/// Returns null if key not found or expired.
///
Task Retrieve(string key, CancellationToken ct = default);
///
/// Retrieves and removes data by claim key atomically.
/// Returns null if key not found or expired.
///
Task RetrieveAndRemove(string key, CancellationToken ct = default);
///
/// Explicitly removes data by claim key.
/// No-op if key not found.
///
Task Remove(string key, CancellationToken ct = default);
}