Search Results for

    Show / Hide Table of Contents
    View Source

    Class LockingMechanism

    Mechanism for handling read and write locks.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.Scoping
    Assembly: Umbraco.Core.dll
    Syntax
    public class LockingMechanism : ILockingMechanism

    Constructors

    View Source

    LockingMechanism(IDistributedLockingMechanismFactory, ILogger<LockingMechanism>)

    Initializes a new instance of the LockingMechanism class.

    Declaration
    public LockingMechanism(IDistributedLockingMechanismFactory distributedLockingMechanismFactory, ILogger<LockingMechanism> logger)
    Parameters
    Type Name Description
    IDistributedLockingMechanismFactory distributedLockingMechanismFactory

    The factory for creating distributed locking mechanisms.

    ILogger<LockingMechanism> logger

    The logger for logging lock-related messages.

    Methods

    View Source

    ClearLocks(Guid)

    Clears all the locks held by a specific scope instance.

    Declaration
    public void ClearLocks(Guid instanceId)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope whose locks should be cleared.

    View Source

    Dispose()

    Declaration
    public void Dispose()
    View Source

    EagerReadLock(Guid, params int[])

    Eagerly acquires a read-lock using the default timeout.

    Declaration
    public void EagerReadLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    int[] lockIds

    Array of lock object identifiers.

    View Source

    EagerReadLock(Guid, TimeSpan?, params int[])

    Eagerly acquires a read-lock

    Declaration
    public void EagerReadLock(Guid instanceId, TimeSpan? timeout = null, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId
    TimeSpan? timeout

    Timeout for the lock

    int[] lockIds
    View Source

    EagerWriteLock(Guid, params int[])

    Eagerly acquires a write-lock using the default timeout.

    Declaration
    public void EagerWriteLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    int[] lockIds

    Array of lock object identifiers.

    View Source

    EagerWriteLock(Guid, TimeSpan?, params int[])

    Eagerly acquires a write-lock.

    Declaration
    public void EagerWriteLock(Guid instanceId, TimeSpan? timeout = null, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    TimeSpan? timeout

    Timeout for the lock.

    int[] lockIds

    Array of lock object identifiers.

    View Source

    EnsureLocks(Guid)

    Acquires all the non-eagerly (lazily) requested locks.

    Declaration
    public void EnsureLocks(Guid scopeInstanceId)
    Parameters
    Type Name Description
    Guid scopeInstanceId

    Instance id of the scope whose pending locks should be acquired.

    View Source

    EnsureLocksCleared(Guid)

    Ensures all locks have been cleared for a specific scope instance, throwing if any remain.

    Declaration
    public void EnsureLocksCleared(Guid instanceId)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope to verify.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when locks have not been properly cleared.

    View Source

    GetReadLocks()

    Gets the dictionary of read locks held by scope instances.

    Declaration
    public Dictionary<Guid, Dictionary<int, int>>? GetReadLocks()
    Returns
    Type Description
    Dictionary<Guid, Dictionary<int, int>>

    A dictionary mapping scope instance IDs to their read lock counts by lock ID, or null if no read locks exist.

    View Source

    GetWriteLocks()

    Gets the dictionary of write locks held by scope instances.

    Declaration
    public Dictionary<Guid, Dictionary<int, int>>? GetWriteLocks()
    Returns
    Type Description
    Dictionary<Guid, Dictionary<int, int>>

    A dictionary mapping scope instance IDs to their write lock counts by lock ID, or null if no write locks exist.

    View Source

    ReadLock(Guid, params int[])

    Read-locks some lock objects lazily using the default timeout.

    Declaration
    public void ReadLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    int[] lockIds

    Array of lock object identifiers.

    View Source

    ReadLock(Guid, TimeSpan?, params int[])

    Read-locks some lock objects lazily.

    Declaration
    public void ReadLock(Guid instanceId, TimeSpan? timeout = null, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock

    TimeSpan? timeout

    Timeout for the lock

    int[] lockIds

    Array of lock object identifiers.

    View Source

    WriteLock(Guid, params int[])

    Write-locks some lock objects lazily using the default timeout.

    Declaration
    public void WriteLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    int[] lockIds

    Array of object identifiers.

    View Source

    WriteLock(Guid, TimeSpan?, params int[])

    Write-locks some lock objects lazily.

    Declaration
    public void WriteLock(Guid instanceId, TimeSpan? timeout = null, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId

    Instance id of the scope who is requesting the lock.

    TimeSpan? timeout

    Timeout for the lock.

    int[] lockIds

    Array of object identifiers.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX