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

    Constructs an instance of LockingMechanism

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

    Methods

    View Source

    ClearLocks(Guid)

    Clears all lock counters for a given scope instance, signalling that the scope has been disposed.

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

    Instance ID of the scope to clear.

    View Source

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    public void Dispose()
    View Source

    EagerReadLock(Guid, params int[])

    Declaration
    public void EagerReadLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId
    int[] lockIds
    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[])

    Declaration
    public void EagerWriteLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId
    int[] lockIds
    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
    TimeSpan? timeout

    Timeout for the lock

    int[] lockIds
    View Source

    EnsureLocks(Guid)

    When we require a ReadLock or a WriteLock we don't immediately request these locks from the database, instead we only request them when necessary (lazily). To do this, we queue requests for read/write locks. This is so that if there's a request for either of these locks, but the service/repository returns an item from the cache, we don't end up making a DB call to make the read/write lock. This executes the queue of requested locks in order in an efficient way lazily whenever the database instance is resolved.

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

    EnsureLocksCleared(Guid)

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

    GetReadLocks()

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

    GetWriteLocks()

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

    ReadLock(Guid, params int[])

    Declaration
    public void ReadLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId
    int[] lockIds
    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[])

    Declaration
    public void WriteLock(Guid instanceId, params int[] lockIds)
    Parameters
    Type Name Description
    Guid instanceId
    int[] lockIds
    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.

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