| IMapTKey, TValueGetAsync Method |
Asynchronously gets the given key.
Namespace:
Hazelcast.Core
Assembly:
Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.11
Syntax Task<TValue> GetAsync(
TKey key
)
Function GetAsync (
key As TKey
) As Task(Of TValue)
Task<TValue>^ GetAsync(
TKey key
)
abstract GetAsync :
key : 'TKey -> Task<'TValue>
Parameters
- key
- Type: TKey
the key of the map entry
Return Value
Type:
TaskTValueTask<V> from which the value of the key can be retrieved.
Remarks
Asynchronously gets the given key.
Task<V> task = map.GetAsync(key);
V value = task.Result;
Task.Result will block until the actual map.Get() completes.
If the application requires timely response,
then task.Wait(timeout) can be used.
try
{
Task<V> task = map.GetAsync(key);
if(task.Wait(TimeSpan.FromMilliseconds(40)))
{
V value = task.Result;
}
else
{
}
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