.NET Client Documentation
5.1.1
Search Results for

    Show / Hide Table of Contents

    LockAsync Method

    LockAsync(TKey)

    Locks an entry.

    Declaration
    Task LockAsync(TKey key)
    Parameters
    TKey key

    The key identifying the entry.

    Returns
    Task

    A task that will complete when the lock has been acquired.

    Remarks

    If the lock is already owned by another owner, this will wait indefinitely until the lock can be acquired.

    Locks are re-entrant, but counted: if a key is locked N times, then it should be unlocked N times before another thread can lock it.

    The lock is automatically released after the server-configured maximum lease time has elapsed.

    LockAsync(TKey, TimeSpan)

    Locks an entry for a given time duration (lease time),

    Declaration
    Task LockAsync(TKey key, TimeSpan leaseTime)
    Parameters
    TKey key

    The key identifying the entry.

    TimeSpan leaseTime

    The lease time.

    Returns
    Task

    A task that will complete when the lock has been acquired.

    Remarks

    If the lock is already owned by another owner, this will wait indefinitely until the lock can be acquired.

    Locks are re-entrant, but counted: if an entry is locked N times, then it should be unlocked N times before another owner can lock it.

    The lock is automatically released after the specified leaseTime has elapsed.

    In This Article
    Back to top Copyright © 2010-2022 Hazelcast, Inc. All rights reserved.
    Generated by DocFX.