TryRemoveAsync Method
TryRemoveAsync(TKey, TimeSpan)
Tries to remove the entry with the given key from this map within the specified time to wait value.
Declaration
Task<bool> TryRemoveAsync(TKey key, TimeSpan timeToWait = default)
Parameters
TKey | key | A key. |
TimeSpan | timeToWait | How long to wait for a lock on the key (-1ms to wait forever; 0ms to not wait at all). |
Returns
Task<bool> |
|
Remarks
If the key is already locked by another thread and/or member, then this operation
will wait for the timeToWait
for acquiring the lock. If the key
is still locked, this operation returns false
. If timeToWait
is
-1ms, waits forever. If it is 0ms, does not wait at all.
The operation also returns false
when no entry with the specified
key
exists.