Table of Contents

Interface IDistributedLock

Namespace
Integrations.Application.Common
Assembly
Integrations.Application.dll

Cluster-wide mutual exclusion (scheduled jobs, rate imports) across replicas.

public interface IDistributedLock

Methods

AcquireAsync(string, CancellationToken)

Waits until the lock is free, then holds it until the handle is disposed.

Task<IAsyncDisposable> AcquireAsync(string name, CancellationToken cancellationToken)

Parameters

name string
cancellationToken CancellationToken

Returns

Task<IAsyncDisposable>

TryAcquireAsync(string, CancellationToken)

Returns a handle when the lock was acquired, or null when another replica holds it.

Task<IAsyncDisposable?> TryAcquireAsync(string name, CancellationToken cancellationToken)

Parameters

name string
cancellationToken CancellationToken

Returns

Task<IAsyncDisposable>