Concurrent, distributed, observable and queryable map.
Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.8.2
Syntax
Type Parameters
- TKey
- type of the Key
- TValue
- type of the Value
The IMapTKey, TValue type exposes the following members.
Methods
Name | Description | |
---|---|---|
AddEntryListener(IEntryListenerTKey, TValue, Boolean) |
Adds an entry listener for this map.
| |
AddEntryListener(IEntryListenerTKey, TValue, IPredicate, Boolean) | Adds an continuous entry listener for this map. | |
AddEntryListener(IEntryListenerTKey, TValue, TKey, Boolean) | Adds the specified entry listener for the specified key. | |
AddEntryListener(IEntryListenerTKey, TValue, IPredicate, TKey, Boolean) | Adds an continuous entry listener for this map. | |
AddIndex |
Adds an index to this map for the specified entries so
that queries can run faster.
| |
AddInterceptor | Adds an interceptor for this map. | |
AggregateTResult(IAggregatorTResult) |
Applies the aggregation logic on all map entries and returns the result
| |
AggregateTResult(IAggregatorTResult, IPredicate) |
Applies the aggregation logic on all map entries and returns the result
| |
Clear |
Removes all of the mappings from this map (optional operation).
| |
ContainsKey |
Determines whether this map contains an entry for the specified key.
| |
ContainsValue |
Determines whether this map contains one or more keys to the specified value
| |
Delete |
Removes the mapping for a key from this map if it is present
(optional operation).
| |
Destroy | Destroys this object cluster-wide. (Inherited from IDistributedObject.) | |
EntrySet |
Returns a
ICollectionT
clone of the mappings contained in this map.
The set is NOT backed by the map,
so changes to the map are NOT reflected in the set, and vice-versa.
| |
EntrySet(IPredicate) |
Queries the map based on the specified predicate and
returns the matching entries.
| |
Evict | Evicts the specified key from this map. | |
EvictAll | Evicts all keys from this map except the locked ones. | |
ExecuteOnEntries(IEntryProcessor) | Applies the user defined EntryProcessor to the all entries in the map. | |
ExecuteOnEntries(IEntryProcessor, IPredicate) |
Applies the user defined EntryProcessor to the entries in the map which satisfies provided predicate.
| |
ExecuteOnKey | Applies the user defined EntryProcessor to the entry mapped by the key. | |
ExecuteOnKeys | Applies the user defined EntryProcessor to the entries mapped by the collection of keys. | |
Flush |
If this map has a MapStore this method flushes
all the local dirty entries by calling MapStore.storeAll() and/or MapStore.deleteAll() | |
ForceUnlock | Releases the lock for the specified key regardless of the lock owner. | |
Get |
Returns the value for the specified key, or null if this map does not contain this key.
| |
GetAll | Returns the entries for the given keys. | |
GetAsync | Asynchronously gets the given key. | |
GetEntryView | Returns the EntryView for the specified key. | |
GetName | Returns the unique name for this IDistributedObject. (Inherited from IDistributedObject.) | |
GetPartitionKey | Returns the key of partition this IDistributedObject is assigned to. (Inherited from IDistributedObject.) | |
GetServiceName | Returns the service name for this object. (Inherited from IDistributedObject.) | |
IsEmpty | Returns true if this map contains no entries. | |
IsLocked | Checks the lock for the specified key. | |
KeySet | Returns a set clone of the keys contained in this map. | |
KeySet(IPredicate) |
Queries the map based on the specified predicate and
returns the keys of matching entries.
| |
Lock(TKey) | Acquires the lock for the specified key. | |
Lock(TKey, Int64, TimeUnit) | Acquires the lock for the specified key for the specified lease time. | |
ProjectTResult(IProjection) |
Applies the projection logic on all map entries and returns the result
| |
ProjectTResult(IProjection, IPredicate) |
Applies the projection logic on all map entries and returns the result
| |
Put(TKey, TValue) |
Associates the specified value with the specified key in this map
If the map previously contained a mapping for
the key, the old value is replaced by the specified value.
| |
Put(TKey, TValue, Int64, TimeUnit) | Puts an entry into this map with a given ttl (time to live) value. | |
PutAll |
Copies all of the mappings from the specified map to this map
| |
PutAsync(TKey, TValue) | Asynchronously puts the given key and value. | |
PutAsync(TKey, TValue, Int64, TimeUnit) | Asynchronously puts the given key and value into this map with a given ttl (time to live) value. | |
PutIfAbsent(TKey, TValue) |
If the specified key is not already associated
with a value, associate it with the given value.
| |
PutIfAbsent(TKey, TValue, Int64, TimeUnit) |
Puts an entry into this map with a given ttl (time to live) value
if the specified key is not already associated with a value.
| |
PutTransient |
Same as Put(TKey, TValue, Int64, TimeUnit)
but MapStore, if defined,
will not be called to store/persist the entry. If ttl is 0, then
the entry lives forever.
| |
Remove(Object) | Removes the mapping for a key from this map if it is present. | |
Remove(Object, Object) | Removes the entry for a key only if currently mapped to a given value. | |
RemoveAll |
Removes all entries which match with the supplied predicate.
| |
RemoveAsync | Asynchronously removes the given key. | |
RemoveEntryListener |
Removes the specified entry listener
Returns silently if there is no such listener added before.
| |
RemoveInterceptor | Removes the given interceptor for this map. | |
Replace(TKey, TValue) | Replaces the entry for a key only if currently mapped to some value. | |
Replace(TKey, TValue, TValue) | Replaces the entry for a key only if currently mapped to a given value. | |
Set(TKey, TValue) | Puts an entry into this map. | |
Set(TKey, TValue, Int64, TimeUnit) | Puts an entry into this map with a given ttl (time to live) value. | |
Size | Returns the number of entries in this map. | |
SubmitToKey |
Applies the user defined EntryProcessor to the entry mapped by the key.
Returns immediately with a Task.
| |
TryLock(TKey) | Tries to acquire the lock for the specified key. | |
TryLock(TKey, Int64, TimeUnit) | Tries to acquire the lock for the specified key. | |
TryLock(TKey, Int64, TimeUnit, Int64, TimeUnit) | Tries to acquire the lock for the specified key for the specified lease time. | |
TryPut |
Tries to put the given key, value into this map within specified timeout value.
| |
TryRemove |
Tries to remove the entry with the given key from this map
within specified timeout value.
| |
Unlock | Releases the lock for the specified key. | |
Values | Returns a collection clone of the values contained in this map. | |
Values(IPredicate) |
Queries the map based on the specified predicate and
returns the values of matching entries.
|
Remarks
This class is not a general-purpose ConcurrentMap implementation! While this class implements the Map interface, it intentionally violates Map's general contract, which mandates the use of the Equals method when comparing objects. Instead of the Equals method this implementation compares the serialized byte version of the objects.
Gotchas:
- Methods, including but not limited to Get, ContainsKey, ContainsValue, Evict, Remove, Put, PutIfAbsent, Replace, Lock, Unlock, do not use GetHashCode and Equals implementations of keys, instead they use GetHashCode and Equals of binary (serialized) forms of the objects.
- Get method returns a clone of original values, modifying the returned value does not change the actual value in the map. One should put modified value back to make changes visible to all nodes. For additional info see IMap<K, V>.Get(object)
- Methods, including but not limited to keySet, values, entrySet, return a collection clone of the values. The collection is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.
See Also