TryPutAsync Method
TryPutAsync(TKey, TValue, TimeSpan)
Tries to set (add or update) an entry.
Declaration
Task<bool> TryPutAsync(TKey key, TValue value, TimeSpan timeToWait)
Parameters
TKey | key | A key. |
TValue | value | A value. |
TimeSpan | timeToWait | How long to wait (-1ms to wait forever; 0ms to not wait at all). |
Returns
Task<Boolean> |
|
Remarks
If the entry is not immediately available, because a lock is set on the key, this will wait
for the specified timeToWait
for the lock. If the lock cannot be acquired in time,
returns null
. If timeToWait
is -1ms, waits forever. If it is 0ms, does
not wait at all.