Search Results for

    Show / Hide Table of Contents
    View Source

    Class SqlMainDomLock

    Implements IMainDomLock using SQL database for distributed lock coordination.

    Inheritance
    object
    Namespace: Umbraco.Cms.Infrastructure.Runtime
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class SqlMainDomLock : IMainDomLock
    Remarks

    This implementation uses a database row in the KeyValue table to coordinate MainDom acquisition across multiple application instances in a load-balanced environment.

    The lock is acquired by inserting or updating a row with a unique identifier. Other instances poll the database to detect when the current MainDom releases the lock.

    Constructors

    View Source

    SqlMainDomLock(ILoggerFactory, IOptions<GlobalSettings>, IOptionsMonitor<ConnectionStrings>, IDbProviderFactoryCreator, IMainDomKeyGenerator, DatabaseSchemaCreatorFactory, NPocoMapperCollection)

    Initializes a new instance of the SqlMainDomLock class.

    Declaration
    public SqlMainDomLock(ILoggerFactory loggerFactory, IOptions<GlobalSettings> globalSettings, IOptionsMonitor<ConnectionStrings> connectionStrings, IDbProviderFactoryCreator dbProviderFactoryCreator, IMainDomKeyGenerator mainDomKeyGenerator, DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory, NPocoMapperCollection npocoMappers)
    Parameters
    Type Name Description
    ILoggerFactory loggerFactory

    The logger factory.

    IOptions<GlobalSettings> globalSettings

    The global settings.

    IOptionsMonitor<ConnectionStrings> connectionStrings

    The connection strings configuration.

    IDbProviderFactoryCreator dbProviderFactoryCreator

    The database provider factory creator.

    IMainDomKeyGenerator mainDomKeyGenerator

    The MainDom key generator.

    DatabaseSchemaCreatorFactory databaseSchemaCreatorFactory

    The database schema creator factory.

    NPocoMapperCollection npocoMappers

    The NPoco mapper collection.

    Methods

    View Source

    AcquireLockAsync(int)

    Acquires an application-wide distributed lock

    Declaration
    public Task<bool> AcquireLockAsync(int millisecondsTimeout)
    Parameters
    Type Name Description
    int millisecondsTimeout
    Returns
    Type Description
    Task<bool>

    An awaitable boolean value which will be false if the elapsed millsecondsTimeout value is exceeded

    View Source

    Dispose()

    Declaration
    public void Dispose()
    View Source

    Dispose(bool)

    Releases unmanaged and - optionally - managed resources.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    View Source

    ListenAsync()

    Wait on a background thread to receive a signal from another AppDomain

    Declaration
    public Task ListenAsync()
    Returns
    Type Description
    Task
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX