![](../icons/Hazelcast-IMDG-Logo-Orange_Dark_200px.jpg) | IMapTKey, TValueTryPut Method |
Tries to put the given key, value into this map within specified timeout value.
Namespace:
Hazelcast.Core
Assembly:
Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.9.4
Syntaxbool TryPut(
TKey key,
TValue value,
long timeout,
TimeUnit timeunit
)
Function TryPut (
key As TKey,
value As TValue,
timeout As Long,
timeunit As TimeUnit
) As Boolean
bool TryPut(
TKey key,
TValue value,
long long timeout,
TimeUnit timeunit
)
abstract TryPut :
key : 'TKey *
value : 'TValue *
timeout : int64 *
timeunit : TimeUnit -> bool
Parameters
- key
- Type: TKey
key of the entry - value
- Type: TValue
value of the entry - timeout
- Type: SystemInt64
maximum time to wait - timeunit
- Type: Hazelcast.CoreTimeUnit
TimeUnit for the timeout
Return Value
Type:
Booleantrue if the put is successful,
false otherwise.
Remarks
Tries to put the given key, value into this map within specified
timeout value. If this method returns false, it means that
the caller thread couldn't acquire the lock for the key within
timeout duration, thus put operation is not successful.
Warning:
This method uses
GetHashCode and
Equals of binary form of
the
key, not the actual implementations of
GetHashCode and
Equals
defined in
key's class.
See Also