Click or drag to resize

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.3
Syntax
bool TryPut(
	TKey key,
	TValue value,
	long timeout,
	TimeUnit timeunit
)

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: Boolean
true 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