Show / Hide Table of Contents

    Class TableBasedDistributedLock

    The base class for the table-based locks.

    Inheritance
    object
    DistributedLock
    TableBasedDistributedLock
    EntityFrameworkLock
    PostgreSqlTableLock
    Implements
    IDistributedLock
    Inherited Members
    DistributedLock.AcquireAsync(CancellationToken)
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Silverback.Lock
    Assembly: Silverback.Storage.Relational.dll
    Syntax
    public abstract class TableBasedDistributedLock : DistributedLock, IDistributedLock

    Constructors

    TableBasedDistributedLock(TableBasedDistributedLockSettings, ISilverbackLogger<TableBasedDistributedLock>)

    Initializes a new instance of the TableBasedDistributedLock class.

    Declaration
    protected TableBasedDistributedLock(TableBasedDistributedLockSettings settings, ISilverbackLogger<TableBasedDistributedLock> logger)
    Parameters
    Type Name Description
    TableBasedDistributedLockSettings settings

    The lock settings.

    ISilverbackLogger<TableBasedDistributedLock> logger

    The logger.

    Methods

    AcquireCoreAsync(CancellationToken)

    Acquires the lock.

    Declaration
    protected override ValueTask<DistributedLockHandle> AcquireCoreAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    A CancellationToken used to cancel the operation.

    Returns
    Type Description
    ValueTask<DistributedLockHandle>

    A Task representing the asynchronous operation.

    Overrides
    DistributedLock.AcquireCoreAsync(CancellationToken)

    ReleaseLockAsync(string)

    Releases the lock.

    Declaration
    protected abstract Task ReleaseLockAsync(string handlerName)
    Parameters
    Type Name Description
    string handlerName

    The name of the current handler.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    TryAcquireLockAsync(string)

    Tries to acquire the lock.

    Declaration
    protected abstract Task<bool> TryAcquireLockAsync(string handlerName)
    Parameters
    Type Name Description
    string handlerName

    The name of the current handler.

    Returns
    Type Description
    Task<bool>

    A Task representing the asynchronous operation. The result is true if the lock was acquired, otherwise false.

    UpdateHeartbeatAsync(string)

    Updates the last heartbeat of the lock.

    Declaration
    protected abstract Task UpdateHeartbeatAsync(string handlerName)
    Parameters
    Type Name Description
    string handlerName

    The name of the current handler.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation.

    Implements

    IDistributedLock
    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini