Members on this page
Meshline.Sdk
Meshline.Interactions
CachedRelayRegistry Class
Adds optional in-memory, demand-triggered caching to a relay registry.
public sealed class CachedRelayRegistry : Meshline.Interactions.IRelayRegistry, System.IAsyncDisposable
Inheritance System.Object → CachedRelayRegistry
Implements IRelayRegistry, System.IAsyncDisposable
Remarks
Reads return cached entries immediately while a due refresh runs in the background. Successful refreshes
defer the next refresh for one hour; failures and missing entries defer retries for one minute.
No timer runs without read demand. These intervals do not define registration validity.
Each instance is isolated to its source registry and network, and may be shared by multiple pools.
Dispose the wrapper after its consumers; the source remains owned by the caller.
Constructors
CachedRelayRegistry(IRelayRegistry) Constructor
Initializes an optional cache around the supplied registry.
public CachedRelayRegistry(Meshline.Interactions.IRelayRegistry source);
Parameters
source IRelayRegistry
The caller-owned registry, whose network and registry context must remain unchanged.
Exceptions
System.ArgumentNullException
The source registry is null.
Properties
CachedRelayRegistry.Context Property
The network reference and registry contract identifying this Meshline network.
public Meshline.Models.NetworkContext Context { get; }
Implements Context
Property Value
Methods
CachedRelayRegistry.DisposeAsync() Method
Cancels and drains cache refreshes without disposing the source registry.
public System.Threading.Tasks.ValueTask DisposeAsync();
Implements DisposeAsync()
Returns
System.Threading.Tasks.ValueTask
A value task that completes after the wrapper's pending refreshes have ended.
Exceptions
System.AggregateException
A cancellation callback throws while refreshes are canceled.
CachedRelayRegistry.GetRelayAsync(string, CancellationToken) Method
Looks up a relay registration by its canonical relay identifier.
public System.Threading.Tasks.Task<Meshline.Models.Registry.RelayEntry?> GetRelayAsync(string relayId, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
Parameters
relayId System.String
The relay's canonical lowercase Neo script-hash identifier.
cancellationToken System.Threading.CancellationToken
A token that can cancel the operation.
Implements GetRelayAsync(string, CancellationToken)
Returns
System.Threading.Tasks.Task<RelayEntry>
The matching registry entry, or null if absent from the provider's current view.
Exceptions
System.ArgumentException
The relay identifier is invalid.
System.IO.InvalidDataException
The source returns invalid or regressed registration data and no cached result is available.
System.ObjectDisposedException
The wrapper has been disposed.
System.OperationCanceledException
The operation observes cancellation of cancellationToken.
Remarks
Caller cancellation only ends that caller's wait. Refresh failures preserve cached entries and are reported through System.Diagnostics.Trace.
CachedRelayRegistry.GetRelaysAsync(CancellationToken) Method
Enumerates the relay registrations available through the registry integration.
public System.Collections.Generic.IAsyncEnumerable<Meshline.Models.Registry.RelayEntry> GetRelaysAsync(System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
Parameters
cancellationToken System.Threading.CancellationToken
A token that can cancel the operation.
Implements GetRelaysAsync(CancellationToken)
Returns
System.Collections.Generic.IAsyncEnumerable<RelayEntry>
A complete, consistent snapshot of the provider's available registrations; entries may have inactive statuses.
Exceptions
System.IO.InvalidDataException
The source returns invalid, duplicate or regressed registrations and no cached snapshot is available.
System.ObjectDisposedException
The wrapper has been disposed.
System.OperationCanceledException
The operation observes cancellation of cancellationToken.
Remarks
A source enumeration is validated in full before publication. Failed refreshes retain the previous snapshot.