Search Results for

    Show / Hide Table of Contents
    View Source

    Interface ILockingMechanism

    Defines a mechanism for acquiring and managing read and write locks on resources.

    Namespace: Umbraco.Cms.Core.Scoping
    Assembly: Umbraco.Core.dll
    Syntax
    public interface ILockingMechanism
    Remarks

    Locks can be acquired lazily (deferred until actually needed) or eagerly (immediately).

    The mechanism tracks locks by scope instance ID to support nested scopes.

    Methods

    View Source

    ClearLocks(Guid)

    Clears all the locks held by a specific scope instance.

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

    Instance id of the scope whose locks should be cleared.

    View Source

    EagerReadLock(Guid, params int[])

    Eagerly acquires a read-lock using the default timeout.

    Declaration
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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