IMapTKey, TValue InterfaceHazelcast .Net Client Class Library
Concurrent, distributed, observable and queryable map.

Namespace: Hazelcast.Core
Assembly: Hazelcast.Net (in Hazelcast.Net.dll) Version: 3.6.3.0
Syntax

public interface IMap<TKey, TValue> : IDistributedObject

Type Parameters

TKey
type of the Key
TValue
type of the Value

The IMapTKey, TValue type exposes the following members.

Methods

  NameDescription
Public methodAddEntryListener(IEntryListenerTKey, TValue, Boolean)
Adds an entry listener for this map.
Public methodAddEntryListener(IEntryListenerTKey, TValue, IPredicate, Boolean)
Adds an continuous entry listener for this map.
Public methodAddEntryListener(IEntryListenerTKey, TValue, TKey, Boolean)
Adds the specified entry listener for the specified key.
Public methodAddEntryListener(IEntryListenerTKey, TValue, IPredicate, TKey, Boolean)
Adds an continuous entry listener for this map.
Public methodAddIndex
Adds an index to this map for the specified entries so that queries can run faster.
Public methodAddInterceptor
Adds an interceptor for this map.
Public methodClear
Removes all of the mappings from this map (optional operation).
Public methodContainsKey
Determines whether this map contains an entry for the specified key.
Public methodContainsValue
Determines whether this map contains one or more keys to the specified value
Public methodDelete
Removes the mapping for a key from this map if it is present (optional operation).
Public methodDestroy
Destroys this object cluster-wide.
(Inherited from IDistributedObject.)
Public methodEntrySet
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.
Public methodEntrySet(IPredicate)
Queries the map based on the specified predicate and returns the matching entries.
Public methodEvict
Evicts the specified key from this map.
Public methodEvictAll
Evicts all keys from this map except the locked ones.
Public methodFlush
If this map has a MapStore this method flushes all the local dirty entries by calling MapStore.storeAll() and/or MapStore.deleteAll()
Public methodForceUnlock
Releases the lock for the specified key regardless of the lock owner.
Public methodGet
Returns the value for the specified key, or null if this map does not contain this key.
Public methodGetAll
Returns the entries for the given keys.
Public methodGetAsync
Asynchronously gets the given key.
Public methodGetEntryView
Returns the EntryView for the specified key.
Public methodGetName
Returns the unique name for this IDistributedObject.
(Inherited from IDistributedObject.)
Public methodGetPartitionKey
Returns the key of partition this IDistributedObject is assigned to.
(Inherited from IDistributedObject.)
Public methodGetServiceName
Returns the service name for this object.
(Inherited from IDistributedObject.)
Public methodIsEmpty
Returns true if this map contains no entries.
Public methodIsLocked
Checks the lock for the specified key.
Public methodKeySet
Returns a set clone of the keys contained in this map.
Public methodKeySet(IPredicate)
Queries the map based on the specified predicate and returns the keys of matching entries.
Public methodLock(TKey)
Acquires the lock for the specified key.
Public methodLock(TKey, Int64, TimeUnit)
Acquires the lock for the specified key for the specified lease time.
Public methodPut(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.
Public methodPut(TKey, TValue, Int64, TimeUnit)
Puts an entry into this map with a given ttl (time to live) value.
Public methodPutAll
Copies all of the mappings from the specified map to this map
Public methodPutAsync(TKey, TValue)
Asynchronously puts the given key and value.
Public methodPutAsync(TKey, TValue, Int64, TimeUnit)
Asynchronously puts the given key and value into this map with a given ttl (time to live) value.
Public methodPutIfAbsent(TKey, TValue)
If the specified key is not already associated with a value, associate it with the given value.
Public methodPutIfAbsent(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.
Public methodPutTransient
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.
Public methodRemove(Object)
Removes the mapping for a key from this map if it is present.
Public methodRemove(Object, Object)
Removes the entry for a key only if currently mapped to a given value.
Public methodRemoveAsync
Asynchronously removes the given key.
Public methodRemoveEntryListener
Removes the specified entry listener Returns silently if there is no such listener added before.
Public methodRemoveInterceptor
Removes the given interceptor for this map.
Public methodReplace(TKey, TValue)
Replaces the entry for a key only if currently mapped to some value.
Public methodReplace(TKey, TValue, TValue)
Replaces the entry for a key only if currently mapped to a given value.
Public methodSet(TKey, TValue)
Puts an entry into this map.
Public methodSet(TKey, TValue, Int64, TimeUnit)
Puts an entry into this map with a given ttl (time to live) value.
Public methodSize
Returns the number of entries in this map.
Public methodTryLock(TKey)
Tries to acquire the lock for the specified key.
Public methodTryLock(TKey, Int64, TimeUnit)
Tries to acquire the lock for the specified key.
Public methodTryLock(TKey, Int64, TimeUnit, Int64, TimeUnit)
Tries to acquire the lock for the specified key for the specified lease time.
Public methodTryPut
Tries to put the given key, value into this map within specified timeout value.
Public methodTryRemove
Tries to remove the entry with the given key from this map within specified timeout value.
Public methodUnlock
Releases the lock for the specified key.
Public methodValues
Returns a collection clone of the values contained in this map.
Public methodValues(IPredicate)
Queries the map based on the specified predicate and returns the values of matching entries.
Top
Remarks

Concurrent, distributed, observable and queryable map.

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

Reference