Hazelcast C++ Client
Public Member Functions | Static Public Attributes | Friends | List of all members
hazelcast::client::IMap< K, V > Class Template Reference

Concurrent, distributed, observable and queryable map client. More...

#include <IMap.h>

Public Member Functions

bool containsKey (const K &key)
 check if this map contains key. More...
 
bool containsValue (const V &value)
 check if this map contains value. More...
 
boost::shared_ptr< V > get (const K &key)
 get the value. More...
 
boost::shared_ptr< V > put (const K &key, const V &value)
 put new entry into map. More...
 
boost::shared_ptr< V > put (const K &key, const V &value, int64_t ttlInMillis)
 Puts an entry into this map with a given ttl (time to live) value. More...
 
boost::shared_ptr< V > remove (const K &key)
 remove entry form map More...
 
void removeAll (const query::Predicate &predicate)
 Removes all entries which match with the supplied predicate. More...
 
bool remove (const K &key, const V &value)
 removes entry from map if there is an entry with same key and value. More...
 
void deleteEntry (const K &key)
 removes entry from map. More...
 
void flush ()
 If this map has a MapStore this method flushes all the local dirty entries by calling MapStore.storeAll() and/or MapStore.deleteAll()
 
bool tryRemove (const K &key, int64_t timeoutInMillis)
 Tries to remove the entry with the given key from this map within specified timeout value. More...
 
bool tryPut (const K &key, const V &value, int64_t timeoutInMillis)
 Tries to put the given key, value into this map within specified timeout value. More...
 
void putTransient (const K &key, const V &value, int64_t ttlInMillis)
 Same as put(K, V, int64_t, TimeUnit) but MapStore, if defined, will not be called to store/persist the entry. More...
 
boost::shared_ptr< V > putIfAbsent (const K &key, const V &value)
 Puts an entry into this map, if the specified key is not already associated with a value. More...
 
boost::shared_ptr< V > putIfAbsent (const K &key, const V &value, int64_t ttlInMillis)
 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. More...
 
bool replace (const K &key, const V &oldValue, const V &newValue)
 Replaces the entry for a key only if currently mapped to a given value. More...
 
boost::shared_ptr< V > replace (const K &key, const V &value)
 Replaces the entry for a key only if currently mapped to some value. More...
 
void lock (const K &key)
 Acquires the lock for the specified key. More...
 
void lock (const K &key, int64_t leaseTime)
 Acquires the lock for the specified key for the specified lease time. More...
 
bool isLocked (const K &key)
 Checks the lock for the specified key. More...
 
bool tryLock (const K &key)
 Tries to acquire the lock for the specified key. More...
 
bool tryLock (const K &key, int64_t timeInMillis)
 Tries to acquire the lock for the specified key. More...
 
void unlock (const K &key)
 Releases the lock for the specified key. More...
 
void forceUnlock (const K &key)
 Releases the lock for the specified key regardless of the lock owner. More...
 
template<typename MapInterceptor >
std::string addInterceptor (MapInterceptor &interceptor)
 Adds an interceptor for this map. More...
 
void removeInterceptor (const std::string &id)
 Removes the given interceptor for this map. More...
 
std::string addEntryListener (EntryListener< K, V > &listener, bool includeValue)
 Adds an entry listener for this map. More...
 
std::string addEntryListener (EntryListener< K, V > &listener, const query::Predicate &predicate, bool includeValue)
 Adds an entry listener for this map. More...
 
bool removeEntryListener (const std::string &registrationId)
 Removes the specified entry listener Returns silently if there is no such listener added before. More...
 
std::string addEntryListener (EntryListener< K, V > &listener, const K &key, bool includeValue)
 Adds the specified entry listener for the specified key. More...
 
EntryView< K, V > getEntryView (const K &key)
 Returns the EntryView for the specified key. More...
 
bool evict (const K &key)
 Evicts the specified key from this map. More...
 
void evictAll ()
 Evicts all keys from this map except locked ones. More...
 
std::map< K, V > getAll (const std::set< K > &keys)
 Returns the entries for the given keys. More...
 
std::vector< K > keySet ()
 Returns a vector clone of the keys contained in this map. More...
 
std::vector< K > keySet (const serialization::IdentifiedDataSerializable &predicate)
 
std::vector< K > keySet (const query::Predicate &predicate)
 Queries the map based on the specified predicate and returns the keys of matching entries. More...
 
std::vector< K > keySet (query::PagingPredicate< K, V > &predicate)
 Queries the map based on the specified predicate and returns the keys of matching entries. More...
 
std::vector< V > values ()
 Returns a vector clone of the values contained in this map. More...
 
std::vector< V > values (const serialization::IdentifiedDataSerializable &predicate)
 
std::vector< V > values (const query::Predicate &predicate)
 Returns a vector clone of the values contained in this map. More...
 
std::vector< V > values (query::PagingPredicate< K, V > &predicate)
 Returns a vector clone of the values contained in this map. More...
 
std::vector< std::pair< K, V > > entrySet ()
 Returns a std::vector< std::pair<K, V> > clone of the mappings contained in this map. More...
 
std::vector< std::pair< K, V > > entrySet (const serialization::IdentifiedDataSerializable &predicate)
 
std::vector< std::pair< K, V > > entrySet (const query::Predicate &predicate)
 Queries the map based on the specified predicate and returns the matching entries. More...
 
std::vector< std::pair< K, V > > entrySet (query::PagingPredicate< K, V > &predicate)
 Queries the map based on the specified predicate and returns the matching entries. More...
 
void addIndex (const std::string &attribute, bool ordered)
 Adds an index to this map for the specified entries so that queries can run faster. More...
 
template<typename ResultType , typename EntryProcessor >
boost::shared_ptr< ResultType > executeOnKey (const K &key, const EntryProcessor &entryProcessor)
 Applies the user defined EntryProcessor to the entry mapped by the key. More...
 
template<typename ResultType , typename EntryProcessor >
std::map< K, boost::shared_ptr< ResultType > > executeOnKeys (const std::set< K > &keys, const EntryProcessor &entryProcessor)
 Applies the user defined EntryProcessor to the entries mapped by the collection of keys. More...
 
template<typename ResultType , typename EntryProcessor >
Future< ResultType > submitToKey (const K &key, const EntryProcessor &entryProcessor)
 Applies the user defined EntryProcessor to the entry mapped by the key. More...
 
template<typename ResultType , typename EntryProcessor >
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries (const EntryProcessor &entryProcessor)
 Applies the user defined EntryProcessor to the all entries in the map. More...
 
template<typename ResultType , typename EntryProcessor >
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries (const EntryProcessor &entryProcessor, const serialization::IdentifiedDataSerializable &predicate)
 
template<typename ResultType , typename EntryProcessor >
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries (const EntryProcessor &entryProcessor, const query::Predicate &predicate)
 Applies the user defined EntryProcessor to the all entries in the map. More...
 
void set (const K &key, const V &value)
 Puts an entry into this map. More...
 
void set (const K &key, const V &value, int64_t ttl)
 
Puts an entry into this map. More...
 
int size ()
 Returns the number of key-value mappings in this map. More...
 
bool isEmpty ()
 Returns true if this map contains no key-value mappings. More...
 
void putAll (const std::map< K, V > &entries)
 Copies all of the mappings from the specified map to this map (optional operation). More...
 
void clear ()
 Removes all of the mappings from this map (optional operation). More...
 
void destroy ()
 Destroys this object cluster-wide. More...
 
monitor::LocalMapStatsgetLocalMapStats ()
 Returns LocalMapStats for this map. More...
 
boost::shared_ptr< ICompletableFuture< V > > getAsync (const K &key)
 Asynchronously gets the given key. More...
 
boost::shared_ptr< ICompletableFuture< V > > putAsync (const K &key, const V &value)
 Asynchronously puts the given key and value. More...
 
boost::shared_ptr< ICompletableFuture< V > > putAsync (const K &key, const V &value, int64_t ttl, const util::concurrent::TimeUnit &ttlUnit)
 Asynchronously puts the given key and value into this map with a given TTL (time to live) value. More...
 
boost::shared_ptr< ICompletableFuture< V > > putAsync (const K &key, const V &value, int64_t ttl, const util::concurrent::TimeUnit &ttlUnit, int64_t maxIdle, const util::concurrent::TimeUnit &maxIdleUnit)
 Asynchronously puts the given key and value into this map with a given TTL (time to live) value and max idle time value. More...
 
boost::shared_ptr< ICompletableFuture< void > > setAsync (const K &key, const V &value)
 Asynchronously puts the given key and value. More...
 
boost::shared_ptr< ICompletableFuture< void > > setAsync (const K &key, const V &value, int64_t ttl, const util::concurrent::TimeUnit &ttlUnit)
 Asynchronously puts an entry into this map with a given TTL (time to live) value, without returning the old value (which is more efficient than. More...
 
boost::shared_ptr< ICompletableFuture< void > > setAsync (const K &key, const V &value, int64_t ttl, const util::concurrent::TimeUnit &ttlUnit, int64_t maxIdle, const util::concurrent::TimeUnit &maxIdleUnit)
 Asynchronously puts an entry into this map with a given TTL (time to live) value and max idle time value. More...
 
boost::shared_ptr< ICompletableFuture< V > > removeAsync (const K &key)
 Asynchronously removes the given key, returning an ICompletableFuture on which the caller can provide an ExecutionCallback<V> to be invoked upon remove operation completion or block waiting for the operation to complete with ICompletableFuture#get(). More...
 

Static Public Attributes

static const std::string SERVICE_NAME = "hz:impl:mapService"
 

Friends

class spi::ProxyManager
 
class impl::HazelcastClientInstanceImpl
 
class adaptor::RawPointerMap< K, V >
 

Detailed Description

template<typename K, typename V>
class hazelcast::client::IMap< K, V >

Concurrent, distributed, observable and queryable map client.

Notice that this class have a private constructor. You can access get an IMap in the following way

 ClientConfig clientConfig;
 HazelcastClient client(clientConfig);
 IMap<int,std::string> imap = client.getMap<int,std::string>("aKey");
Parameters
<K>key
<V>value

Member Function Documentation

◆ addEntryListener() [1/3]

template<typename K, typename V>
std::string hazelcast::client::IMap< K, V >::addEntryListener ( EntryListener< K, V > &  listener,
bool  includeValue 
)
inline

Adds an entry listener for this map.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerentry listener
includeValuetrue if EntryEvent should contain the value.
Returns
registrationId of added listener that can be used to remove the entry listener.

◆ addEntryListener() [2/3]

template<typename K, typename V>
std::string hazelcast::client::IMap< K, V >::addEntryListener ( EntryListener< K, V > &  listener,
const query::Predicate predicate,
bool  includeValue 
)
inline

Adds an entry listener for this map.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerentry listener
predicateThe query filter to use when returning the events to the user.
includeValuetrue if EntryEvent should contain the value.
Returns
registrationId of added listener that can be used to remove the entry listener.

◆ addEntryListener() [3/3]

template<typename K, typename V>
std::string hazelcast::client::IMap< K, V >::addEntryListener ( EntryListener< K, V > &  listener,
const K &  key,
bool  includeValue 
)
inline

Adds the specified entry listener for the specified key.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerentry listener
keykey to listen
includeValuetrue if EntryEvent should contain the value.

◆ addIndex()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::addIndex ( const std::string &  attribute,
bool  ordered 
)
inline

Adds an index to this map for the specified entries so that queries can run faster.

Let's say your map values are Employee objects.

class Employee : public serialization::Portable { //... private: bool active; int age; std::string name;

}

If you are querying your values mostly based on age and active then you should consider indexing these fields.

IMap<std::string, Employee > imap = hazelcastInstance.getMap<std::string, Employee >("employees"); imap.addIndex("age", true); // ordered, since we have ranged queries for this field imap.addIndex("active", false); // not ordered, because boolean field cannot have range

In the server side, Index should either have a getter method or be public. You should also make sure to add the indexes before adding entries to this map.

Parameters
attributeattribute of value
orderedtrue if index should be ordered, false otherwise.

◆ addInterceptor()

template<typename K, typename V>
template<typename MapInterceptor >
std::string hazelcast::client::IMap< K, V >::addInterceptor ( MapInterceptor &  interceptor)
inline

Adds an interceptor for this map.

Added interceptor will intercept operations and execute user defined methods and will cancel operations if user defined method throw exception.

Interceptor should extend either Portable or IdentifiedSerializable. Notice that map interceptor runs on the nodes. Because of that same class should be implemented in java side with same classId and factoryId.

Parameters
interceptormap interceptor
Returns
id of registered interceptor

◆ clear()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::clear ( )
inline

Removes all of the mappings from this map (optional operation).

The map will be empty after this call returns.

◆ containsKey()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::containsKey ( const K &  key)
inline

check if this map contains key.

Parameters
key
Returns
true if contains, false otherwise
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ containsValue()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::containsValue ( const V &  value)
inline

check if this map contains value.

Parameters
value
Returns
true if contains, false otherwise
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ deleteEntry()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::deleteEntry ( const K &  key)
inline

removes entry from map.

Does not return anything.

Parameters
keyThe key of the map entry to remove.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ destroy()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::destroy ( )
inline

Destroys this object cluster-wide.

Clears and releases all resources for this object.

◆ entrySet() [1/4]

template<typename K, typename V>
std::vector<std::pair<K, V> > hazelcast::client::IMap< K, V >::entrySet ( )
inline

Returns a std::vector< std::pair<K, V> > clone of the mappings contained in this map.

The vector is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.

Returns
a vector clone of the keys mappings in this map

◆ entrySet() [2/4]

template<typename K, typename V>
std::vector<std::pair<K, V> > hazelcast::client::IMap< K, V >::entrySet ( const serialization::IdentifiedDataSerializable predicate)
inline
Deprecated:
This API is deprecated in favor of
See also
{entrySet(const query::Predicate &predicate)}

Queries the map based on the specified predicate and returns the matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result entry vector of the query

◆ entrySet() [3/4]

template<typename K, typename V>
std::vector<std::pair<K, V> > hazelcast::client::IMap< K, V >::entrySet ( const query::Predicate predicate)
inline

Queries the map based on the specified predicate and returns the matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result entry vector of the query

◆ entrySet() [4/4]

template<typename K, typename V>
std::vector<std::pair<K, V> > hazelcast::client::IMap< K, V >::entrySet ( query::PagingPredicate< K, V > &  predicate)
inline

Queries the map based on the specified predicate and returns the matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result entry vector of the query

◆ evict()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::evict ( const K &  key)
inline

Evicts the specified key from this map.

If a MapStore defined for this map, then the entry is not deleted from the underlying MapStore, evict only removes the entry from the memory.

Parameters
keykey to evict
Returns
true if the key is evicted, false otherwise.

◆ evictAll()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::evictAll ( )
inline

Evicts all keys from this map except locked ones.

If a MapStore is defined for this map, deleteAll is not called by this method. If you do want to deleteAll to be called use the clear() method.

The EVICT_ALL event is fired for any registered listeners. See EntryListener::mapEvicted(MapEvent)}.

See also
clear()

◆ executeOnEntries() [1/3]

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
std::map<K, boost::shared_ptr<ResultType> > hazelcast::client::IMap< K, V >::executeOnEntries ( const EntryProcessor &  entryProcessor)
inline

Applies the user defined EntryProcessor to the all entries in the map.

Returns the results mapped by each key in the map.

EntryProcessor should extend either Portable or IdentifiedSerializable. Notice that map EntryProcessor runs on the nodes. Because of that, same class should be implemented in java side with same classId and factoryId.

Template Parameters
ResultTypethat entry processor will return
EntryProcessortype of entry processor class
Parameters
entryProcessorthat will be applied

◆ executeOnEntries() [2/3]

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
std::map<K, boost::shared_ptr<ResultType> > hazelcast::client::IMap< K, V >::executeOnEntries ( const EntryProcessor &  entryProcessor,
const serialization::IdentifiedDataSerializable predicate 
)
inline
Deprecated:
This API is deprecated in favor of
See also
{executeOnEntries(EntryProcessor &entryProcessor, const query::Predicate &predicate)}

Applies the user defined EntryProcessor to the all entries in the map. Returns the results mapped by each key in the map.

EntryProcessor should extend either Portable or IdentifiedSerializable. Notice that map EntryProcessor runs on the nodes. Because of that, same class should be implemented in java side with same classId and factoryId.

Template Parameters
ResultTypethat entry processor will return
EntryProcessortype of entry processor class
predicateThe filter to apply for selecting the entries at the server side.
Parameters
entryProcessorthat will be applied

◆ executeOnEntries() [3/3]

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
std::map<K, boost::shared_ptr<ResultType> > hazelcast::client::IMap< K, V >::executeOnEntries ( const EntryProcessor &  entryProcessor,
const query::Predicate predicate 
)
inline

Applies the user defined EntryProcessor to the all entries in the map.

Returns the results mapped by each key in the map.

EntryProcessor should extend either Portable or IdentifiedSerializable. Notice that map EntryProcessor runs on the nodes. Because of that, same class should be implemented in java side with same classId and factoryId.

Template Parameters
ResultTypethat entry processor will return
EntryProcessortype of entry processor class
predicateThe filter to apply for selecting the entries at the server side.
Parameters
entryProcessorthat will be applied

◆ executeOnKey()

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
boost::shared_ptr<ResultType> hazelcast::client::IMap< K, V >::executeOnKey ( const K &  key,
const EntryProcessor &  entryProcessor 
)
inline

Applies the user defined EntryProcessor to the entry mapped by the key.

Returns the the ResultType which is result of the process() method of EntryProcessor.

EntryProcessor should extend either Portable or IdentifiedSerializable. Notice that map EntryProcessor runs on the nodes. Because of that, same class should be implemented in java side with same classId and factoryId.

Template Parameters
EntryProcessortype of entry processor class
ResultTypethat entry processor will return
Parameters
entryProcessorthat will be applied
keyof entry that entryProcessor will be applied on
Returns
result of entry process.

◆ executeOnKeys()

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
std::map<K, boost::shared_ptr<ResultType> > hazelcast::client::IMap< K, V >::executeOnKeys ( const std::set< K > &  keys,
const EntryProcessor &  entryProcessor 
)
inline

Applies the user defined EntryProcessor to the entries mapped by the collection of keys.

Returns the results mapped by each key in the map.

Notice that map EntryProcessor runs on the nodes. Because of that, same class should be implemented in java side

Template Parameters
ResultTypethat entry processor will return
EntryProcessortype of entry processor class
keysThe keys for which the entry processor will be applied.
Parameters
entryProcessorthat will be applied

◆ forceUnlock()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::forceUnlock ( const K &  key)
inline

Releases the lock for the specified key regardless of the lock owner.

It always successfully unlocks the key, never blocks and returns immediately.

Parameters
keykey to lock.

◆ get()

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::get ( const K &  key)
inline

get the value.

Parameters
key
Returns
value value in shared_ptr, if there is no mapping for key then return NULL in shared_ptr.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ getAll()

template<typename K, typename V>
std::map<K, V> hazelcast::client::IMap< K, V >::getAll ( const std::set< K > &  keys)
inline

Returns the entries for the given keys.

Parameters
keyskeys to get
Returns
map of entries

◆ getAsync()

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<V> > hazelcast::client::IMap< K, V >::getAsync ( const K &  key)
inline

Asynchronously gets the given key.

  boost::shared_ptr<ICompletableFuture> future = map.getAsync(key);
  // do some other stuff, when ready get the result.
  boost::shared_ptr<V> value = future->get();

ICompletableFuture#get() will block until the actual map.get() completes. If the application requires timely response, then ICompletableFuture#get(int64_t, const util::concurrent::TimeUnit::TimeUnit&) can be used.

  try {
    boost::shared_ptr<ICompletableFuture> future = map.getAsync(key);
    boost::shared_ptr<V> value = future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

Additionally, the client can schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

// assuming an IMap<std::string, std::string>
ICompletableFuture<std::string> future = map.getAsync("a");
future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new MyExecutionCallback()));

ExecutionException is never thrown.

Warning:

Interactions with the map store

Parameters
keythe key of the map entry
Returns
ICompletableFuture from which the value of the key can be retrieved
See also
ICompletableFuture

◆ getEntryView()

template<typename K, typename V>
EntryView<K, V> hazelcast::client::IMap< K, V >::getEntryView ( const K &  key)
inline

Returns the EntryView for the specified key.

Parameters
keykey of the entry
Returns
EntryView of the specified key
See also
EntryView

◆ getLocalMapStats()

template<typename K, typename V>
monitor::LocalMapStats& hazelcast::client::IMap< K, V >::getLocalMapStats ( )
inline

Returns LocalMapStats for this map.

LocalMapStats is the statistics for the local portion of this distributed map and contains information such as ownedEntryCount backupEntryCount, lastUpdateTime, lockedEntryCount.

Since this stats are only for the local portion of this map, if you need the cluster-wide MapStats then you need to get the LocalMapStats from all members of the cluster and combine them.

Returns
this map's local statistics.

◆ isEmpty()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::isEmpty ( )
inline

Returns true if this map contains no key-value mappings.

Returns
true if this map contains no key-value mappings

◆ isLocked()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::isLocked ( const K &  key)
inline

Checks the lock for the specified key.

If the lock is acquired then returns true, else false.

Parameters
keykey to lock to be checked.
Returns
true if lock is acquired, false otherwise.

◆ keySet() [1/4]

template<typename K, typename V>
std::vector<K> hazelcast::client::IMap< K, V >::keySet ( )
inline

Returns a vector clone of the keys contained in this map.

The vector is NOT backed by the map, so changes to the map are NOT reflected in the vector, and vice-versa.

Returns
a vector clone of the keys contained in this map

◆ keySet() [2/4]

template<typename K, typename V>
std::vector<K> hazelcast::client::IMap< K, V >::keySet ( const serialization::IdentifiedDataSerializable predicate)
inline
Deprecated:
This API is deprecated in favor of
See also
{keySet(const query::Predicate &predicate)}

Queries the map based on the specified predicate and returns the keys of matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result key set of the query

◆ keySet() [3/4]

template<typename K, typename V>
std::vector<K> hazelcast::client::IMap< K, V >::keySet ( const query::Predicate predicate)
inline

Queries the map based on the specified predicate and returns the keys of matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result key set of the query

◆ keySet() [4/4]

template<typename K, typename V>
std::vector<K> hazelcast::client::IMap< K, V >::keySet ( query::PagingPredicate< K, V > &  predicate)
inline

Queries the map based on the specified predicate and returns the keys of matching entries.

Specified predicate runs on all members in parallel.

Parameters
predicatequery criteria
Returns
result key set of the query

◆ lock() [1/2]

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::lock ( const K &  key)
inline

Acquires the lock for the specified key.

If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.

Scope of the lock is this map only. Acquired lock is only for the key in this map.

Locks are re-entrant so if the key is locked N times then it should be unlocked N times before another thread can acquire it.

Parameters
keykey to lock.

◆ lock() [2/2]

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::lock ( const K &  key,
int64_t  leaseTime 
)
inline

Acquires the lock for the specified key for the specified lease time.

After lease time, lock will be released..

If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock has been acquired.

Scope of the lock is this map only. Acquired lock is only for the key in this map.

Locks are re-entrant so if the key is locked N times then it should be unlocked N times before another thread can acquire it.

Parameters
keykey to lock.
leaseTimetime in milliseconds to wait before releasing the lock.

◆ put() [1/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::put ( const K &  key,
const V &  value 
)
inline

put new entry into map.

Parameters
key
value
Returns
the previous value in shared_ptr, if there is no mapping for key
Exceptions
IClassCastExceptionif the type of the specified elements are incompatible with the server side. then returns NULL in shared_ptr.

◆ put() [2/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::put ( const K &  key,
const V &  value,
int64_t  ttlInMillis 
)
inline

Puts an entry into this map with a given ttl (time to live) value.

Entry will expire and get evicted after the ttl. If ttl is 0, then the entry lives forever.

Parameters
keykey of the entry
valuevalue of the entry
ttlInMillismaximum time for this entry to stay in the map in milliseconds,0 means infinite.
Returns
the previous value in shared_ptr, if there is no mapping for key then returns NULL in shared_ptr.

◆ putAll()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::putAll ( const std::map< K, V > &  entries)
inline

Copies all of the mappings from the specified map to this map (optional operation).

The effect of this call is equivalent to that of calling put(k, v) on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

Parameters
entriesmappings to be stored in this map

◆ putAsync() [1/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<V> > hazelcast::client::IMap< K, V >::putAsync ( const K &  key,
const V &  value 
)
inline

Asynchronously puts the given key and value.

  boost::shared_ptr<V> value = future->putAsync(key, value);
  // do some other stuff, when ready get the result.
  boost::shared_ptr<V> value = future->get();

ICompletableFuture::get() will block until the actual map.put() completes. If the application requires a timely response, then you can use ICompletableFuture::get(int64_t, const util::concurrent::TimeUnit::TimeUnit&)}.

  try {
    boost::shared_ptr<ICompletableFuture> future = imap.putAsync(key, newValue);
    boost::shared_ptr<V> value = future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

Additionally, the client can schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

// assuming an IMap<std::string, std::string>
boost::shared_ptr<ICompletableFuture> future = map.putAsync("a", "b");
future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new MyExecutionCallback()));

ExecutionException is never thrown.

Note: Use setAsync(const K&, const V &) if you don't need the return value, it's slightly more efficient.

Interactions with the map store

If no value is found with

key

in memory, MapLoader#load(Object) is invoked at server to load the value from the map store backing the map. Exceptions thrown by load fail the operation and are propagated to the caller.

If write-through persistence mode is configured, before the value is stored in memory, server MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
Returns
ICompletableFuture from which the old value of the key can be retrieved
See also
ICompletableFuture
#setAsync(Object, Object)

◆ putAsync() [2/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<V> > hazelcast::client::IMap< K, V >::putAsync ( const K &  key,
const V &  value,
int64_t  ttl,
const util::concurrent::TimeUnit &  ttlUnit 
)
inline

Asynchronously puts the given key and value into this map with a given TTL (time to live) value.

The entry will expire and get evicted after the TTL. If the TTL is 0, then the entry lives forever. If the TTL is negative, then the TTL from the map configuration will be used (default: forever).

  boost::shared_ptr<ICompletableFuture> future = map.putAsync(key, value, ttl, timeunit);
  // do some other stuff, when ready get the result
  boost::shared_ptr<V> value = future->get();

ICompletableFuture::get() will block until the actual map.put() completes. If your application requires a timely response, then you can use ICompletableFuture::get(int64_t, const util::concurrent::TimeUnit::TimeUnit&)}.

  try {
    boost::shared_ptr<ICompletableFuture> future = map.putAsync(key, newValue, ttl, timeunit);
    boost::shared_ptr<V> oldValue = future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

The client can schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

// assuming an IMap<std::string, std::string>
boost::shared_ptr<ICompletableFuture> future = map.putAsync("a", "b", 5, util::concurrent::TimeUnit::MINUTES());
future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new MyExecutionCallback()));

ExecutionException is never thrown.

Warning:

Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.

Note: Use setAsync(const K &, const V &, int64_t, const util::concurrent::TimeUnit &) if you don't need the return value, it's slightly more efficient.

Interactions with the map store

If no value is found with

key

in memory, server MapLoader#load(Object) is invoked to load the value from the map store backing the map. Exceptions thrown by load fail the operation and are propagated to the caller.

If write-through persistence mode is configured, before the value is stored in memory, server MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
ttlmaximum time for this entry to stay in the map (0 means infinite, negative means map config default)
ttlUnittime unit for the TTL
Returns
ICompletableFuture from which the old value of the key can be retrieved
See also
ICompletableFuture
#setAsync(const K&, const V&, int64_t, TimeUnit)

◆ putAsync() [3/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<V> > hazelcast::client::IMap< K, V >::putAsync ( const K &  key,
const V &  value,
int64_t  ttl,
const util::concurrent::TimeUnit &  ttlUnit,
int64_t  maxIdle,
const util::concurrent::TimeUnit &  maxIdleUnit 
)
inline

Asynchronously puts the given key and value into this map with a given TTL (time to live) value and max idle time value.

The entry will expire and get evicted after the TTL. If the TTL is 0, then the entry lives forever. If the TTL is negative, then the TTL from the map configuration will be used (default: forever).

The entry will expire and get evicted after the Max Idle time. If the MaxIdle is 0, then the entry lives forever. If the MaxIdle is negative, then the MaxIdle from the map configuration will be used (default: forever).

  boost::shared_ptr<ICompletableFuture> future = map.putAsync(key, value, ttl, timeunit);
  // do some other stuff, when ready get the result
  boost::shared_ptr<V> value = future->get();

ICompletableFuture::get() will block until the actual map.put() completes. If your application requires a timely response, then you can use ICompletableFuture::get(int64_t, const util::concurrent::TimeUnit::TimeUnit&)}.

  try {
    boost::shared_ptr<ICompletableFuture> future = map.putAsync(key, newValue, ttl, timeunit);
    Object oldValue = future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

The client can schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

// assuming an IMap<std::string, std::string>
boost::shared_ptr<ICompletableFuture> future = map.putAsync("a", "b", 5, util::concurrent::TimeUnit::MINUTES());
future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new MyExecutionCallback()));

ExecutionException is never thrown.

Warning:

Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.

Note: Use setAsync(const K&, const V&, int64_t, TimeUnit) if you don't need the return value, it's slightly more efficient.

Interactions with the map store

If no value is found with

key

in memory, MapLoader#load(Object) is invoked to load the value from the map store backing the map. Exceptions thrown by load fail the operation and are propagated to the caller.

If write-through persistence mode is configured, before the value is stored in memory, MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
ttlmaximum time for this entry to stay in the map (0 means infinite, negative means map config default)
ttlUnittime unit for the TTL
maxIdlemaximum time for this entry to stay idle in the map. (0 means infinite, negative means map config default)
maxIdleUnittime unit for the Max-Idle
Returns
ICompletableFuture from which the old value of the key can be retrieved
See also
ICompletableFuture
#setAsync(const K&, const V&, int64_t, TimeUnit)

◆ putIfAbsent() [1/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::putIfAbsent ( const K &  key,
const V &  value 
)
inline

Puts an entry into this map, if the specified key is not already associated with a value.

Parameters
keykey with which the specified value is to be associated
value
Returns
the previous value in shared_ptr, if there is no mapping for key then returns NULL in shared_ptr.

◆ putIfAbsent() [2/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::putIfAbsent ( const K &  key,
const V &  value,
int64_t  ttlInMillis 
)
inline

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.

Entry will expire and get evicted after the ttl.

Parameters
keykey of the entry
valuevalue of the entry
ttlInMillismaximum time in milliseconds for this entry to stay in the map
Returns
the previous value of the entry, if there is no mapping for key then returns NULL in shared_ptr.

◆ putTransient()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::putTransient ( const K &  key,
const V &  value,
int64_t  ttlInMillis 
)
inline

Same as put(K, V, int64_t, TimeUnit) but MapStore, if defined, will not be called to store/persist the entry.

If ttl is 0, then the entry lives forever.

Parameters
keykey of the entry
valuevalue of the entry
ttlInMillismaximum time for this entry to stay in the map in milliseconds, 0 means infinite.

◆ remove() [1/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::remove ( const K &  key)
inline

remove entry form map

Parameters
key
Returns
the previous value in shared_ptr, if there is no mapping for key then returns NULL in shared_ptr.
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ remove() [2/2]

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::remove ( const K &  key,
const V &  value 
)
inline

removes entry from map if there is an entry with same key and value.

Parameters
key
value
Returns
true if remove is successful false otherwise
Exceptions
IClassCastExceptionif the type of the specified element is incompatible with the server side.

◆ removeAll()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::removeAll ( const query::Predicate predicate)
inline

Removes all entries which match with the supplied predicate.

If this map has index, matching entries will be found via index search, otherwise they will be found by full-scan.

Note that calling this method also removes all entries from callers Near Cache.

Parameters
predicatematching entries with this predicate will be removed from this map

◆ removeAsync()

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<V> > hazelcast::client::IMap< K, V >::removeAsync ( const K &  key)
inline

Asynchronously removes the given key, returning an ICompletableFuture on which the caller can provide an ExecutionCallback<V> to be invoked upon remove operation completion or block waiting for the operation to complete with ICompletableFuture#get().

Interactions with the map store

If write-through persistence mode is configured, before the value is removed from the the memory, MapStore#delete(Object) is called to remove the value from the map store. Exceptions thrown by delete fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keyThe key of the map entry to remove
Returns
ICompletableFuture from which the value removed from the map can be retrieved
See also
ICompletableFuture

◆ removeEntryListener()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::removeEntryListener ( const std::string &  registrationId)
inline

Removes the specified entry listener Returns silently if there is no such listener added before.

Parameters
registrationIdid of registered listener
Returns
true if registration is removed, false otherwise

◆ removeInterceptor()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::removeInterceptor ( const std::string &  id)
inline

Removes the given interceptor for this map.

So it will not intercept operations anymore.

Parameters
idregistration id of map interceptor

◆ replace() [1/2]

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::replace ( const K &  key,
const V &  oldValue,
const V &  newValue 
)
inline

Replaces the entry for a key only if currently mapped to a given value.

Parameters
keykey with which the specified value is associated
oldValuevalue expected to be associated with the specified key
newValue
Returns
true if the value was replaced

◆ replace() [2/2]

template<typename K, typename V>
boost::shared_ptr<V> hazelcast::client::IMap< K, V >::replace ( const K &  key,
const V &  value 
)
inline

Replaces the entry for a key only if currently mapped to some value.

Parameters
keykey with which the specified value is associated
value
Returns
the previous value of the entry, if there is no mapping for key then returns NULL in shared_ptr.

◆ set() [1/2]

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::set ( const K &  key,
const V &  value 
)
inline

Puts an entry into this map.

Similar to put operation except that set doesn't return the old value which is more efficient.

Parameters
key
value

◆ set() [2/2]

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::set ( const K &  key,
const V &  value,
int64_t  ttl 
)
inline


Puts an entry into this map.

Similar to put operation except that set doesn't return the old value which is more efficient.

Parameters
keykey with which the specified value is associated
value
ttlmaximum time in milliseconds for this entry to stay in the map 0 means infinite.

◆ setAsync() [1/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<void> > hazelcast::client::IMap< K, V >::setAsync ( const K &  key,
const V &  value 
)
inline

Asynchronously puts the given key and value.

The entry lives forever. Similar to the put operation except that set doesn't return the old value, which is more efficient.

boost::shared_ptr<ICompletableFuture<void> > future = map.setAsync(key, value);
// do some other stuff, when ready wait for completion
future->get();

ICompletableFuture::get() will block until the actual map.set() operation completes. If your application requires a timely response, then you can use ICompletableFuture::get(int64_t, const util::concurrent::TimeUnit::TimeUnit&)}.

try {
boost::shared_ptr<ICompletableFuture<void> > future = map.setAsync(key, newValue);
future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
} catch (exception::TimeoutException &t) {
// time wasn't enough
}

You can also schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new MyExecutionCallback()));

ExecutionException is never thrown.

Interactions with the map store

If write-through persistence mode is configured, before the value is stored in memory, MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
Returns
ICompletableFuture on which to block waiting for the operation to complete or register an ExecutionCallback<V> to be invoked upon completion
See also
ICompletableFuture

◆ setAsync() [2/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<void> > hazelcast::client::IMap< K, V >::setAsync ( const K &  key,
const V &  value,
int64_t  ttl,
const util::concurrent::TimeUnit &  ttlUnit 
)
inline

Asynchronously puts an entry into this map with a given TTL (time to live) value, without returning the old value (which is more efficient than.

put()

).

The entry will expire and get evicted after the TTL. If the TTL is 0, then the entry lives forever. If the TTL is negative, then the TTL from the map configuration will be used (default: forever).

The entry will expire and get evicted after the Max Idle time. If the MaxIdle is 0, then the entry lives forever. If the MaxIdle is negative, then the MaxIdle from the map configuration will be used (default: forever).

  ICompletableFuture<void> future = map.setAsync(key, value, ttl, timeunit);
  // do some other stuff, when you want to make sure set operation is complete:
  future->get();

ICompletableFuture::get() will block until the actual map set operation completes. If your application requires a timely response, then you can use ICompletableFuture#get(int64_t, TimeUnit).

  try {
    boost::shared_ptr<ICompletableFuture<void> > future = map.setAsync(key, newValue, ttl, timeunit);
    future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

You can also schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

  ICompletableFuture<void> future = map.setAsync("a", "b", 5, util::concurrent::TimeUnit::MINUTES());
  future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new  MyExecutionCallback()));

ExecutionException is never thrown.

Warning:

Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.

Interactions with the map store

If write-through persistence mode is configured, before the value is stored in memory, MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller..

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
ttlmaximum time for this entry to stay in the map (0 means infinite, negative means map config default)
ttlUnittime unit for the TTL
Returns
ICompletableFuture on which client code can block waiting for the operation to complete or provide an ExecutionCallback<V> to be invoked upon set operation completion
See also
ICompletableFuture

◆ setAsync() [3/3]

template<typename K, typename V>
boost::shared_ptr<ICompletableFuture<void> > hazelcast::client::IMap< K, V >::setAsync ( const K &  key,
const V &  value,
int64_t  ttl,
const util::concurrent::TimeUnit &  ttlUnit,
int64_t  maxIdle,
const util::concurrent::TimeUnit &  maxIdleUnit 
)
inline

Asynchronously puts an entry into this map with a given TTL (time to live) value and max idle time value.

without returning the old value (which is more efficient than

put()

).

The entry will expire and get evicted after the TTL. If the TTL is 0, then the entry lives forever. If the TTL is negative, then the TTL from the map configuration will be used (default: forever).

The entry will expire and get evicted after the Max Idle time. If the MaxIdle is 0, then the entry lives forever. If the MaxIdle is negative, then the MaxIdle from the map configuration will be used (default: forever).

  ICompletableFuture<void> future = map.setAsync(key, value, ttl, timeunit);
  // do some other stuff, when you want to make sure set operation is complete:
  future->get();

ICompletableFuture::get() will block until the actual map set operation completes. If your application requires a timely response, then you can use ICompletableFuture#get(int64_t, TimeUnit).

  try {
    boost::shared_ptr<ICompletableFuture<void> > future = map.setAsync(key, newValue, ttl, timeunit);
    future->get(40, util::concurrent::TimeUnit::MILLISECONDS());
  } catch (exception::TimeoutException &t) {
    // time wasn't enough
  }

You can also schedule an ExecutionCallback<V> to be invoked upon completion of the

ICompletableFuture

via ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &) or ICompletableFuture#andThen(const boost::shared_ptr<ExecutionCallback<V> > &, const boost::shared_ptr<Executor> &):

  ICompletableFuture<void> future = map.setAsync("a", "b", 5, util::concurrent::TimeUnit::MINUTES());
  future->andThen(boost::shared_ptr<ExecutionCallback<V> >(new  MyExecutionCallback()));

ExecutionException is never thrown.

Warning:

Time resolution for TTL is seconds. The given TTL value is rounded to the next closest second value.

Interactions with the map store

If write-through persistence mode is configured, before the value is stored in memory, MapStore#store(Object, Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller..

If write-behind persistence mode is configured with write-coalescing turned off, ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.

Parameters
keythe key of the map entry
valuethe new value of the map entry
ttlmaximum time for this entry to stay in the map (0 means infinite, negative means map config default)
ttlUnittime unit for the TTL
maxIdlemaximum time for this entry to stay idle in the map. (0 means infinite, negative means map config default)
maxIdleUnittime unit for the Max-Idle
Returns
ICompletableFuture on which client code can block waiting for the operation to complete or provide an ExecutionCallback<V> to be invoked upon set operation completion
See also
ICompletableFuture

◆ size()

template<typename K, typename V>
int hazelcast::client::IMap< K, V >::size ( )
inline

Returns the number of key-value mappings in this map.

If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns
the number of key-value mappings in this map

◆ submitToKey()

template<typename K, typename V>
template<typename ResultType , typename EntryProcessor >
Future<ResultType> hazelcast::client::IMap< K, V >::submitToKey ( const K &  key,
const EntryProcessor &  entryProcessor 
)
inline

Applies the user defined EntryProcessor to the entry mapped by the key.

Returns immediately with a Future representing that task.

Parameters
keykey to be processed
entryProcessorprocessor to process the key
Returns
Future from which the result of the operation can be retrieved.

◆ tryLock() [1/2]

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::tryLock ( const K &  key)
inline

Tries to acquire the lock for the specified key.

If the lock is not available then the current thread doesn't wait and returns false immediately.

Parameters
keykey to lock.
Returns
true if lock is acquired, false otherwise.

◆ tryLock() [2/2]

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::tryLock ( const K &  key,
int64_t  timeInMillis 
)
inline

Tries to acquire the lock for the specified key.

If the lock is not available then the current thread becomes disabled for thread scheduling purposes and lies dormant until one of two things happens:

  • The lock is acquired by the current thread; or
  • The specified waiting time elapses
Parameters
keykey to lock in this map
timeInMillismaximum time in milliseconds to wait for the lock
Returns
true if the lock was acquired and false if the waiting time elapsed before the lock was acquired.

◆ tryPut()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::tryPut ( const K &  key,
const V &  value,
int64_t  timeoutInMillis 
)
inline

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.

Parameters
keykey of the entry
valuevalue of the entry
timeoutInMillismaximum time to wait in milliseconds
Returns
true if the put is successful, false otherwise.

◆ tryRemove()

template<typename K, typename V>
bool hazelcast::client::IMap< K, V >::tryRemove ( const K &  key,
int64_t  timeoutInMillis 
)
inline

Tries to remove the entry with the given key from this map within specified timeout value.

If the key is already locked by another thread and/or member, then this operation will wait timeout amount for acquiring the lock.

Parameters
keykey of the entry
timeoutInMillismaximum time in milliseconds to wait for acquiring the lock for the key

◆ unlock()

template<typename K, typename V>
void hazelcast::client::IMap< K, V >::unlock ( const K &  key)
inline

Releases the lock for the specified key.

It never blocks and returns immediately.

If the current thread is the holder of this lock then the hold count is decremented. If the hold count is now zero then the lock is released. If the current thread is not the holder of this lock then IllegalMonitorStateException is thrown.

Parameters
keykey to lock.
Exceptions
IllegalMonitorStateExceptionif the current thread does not hold this lock MTODO

◆ values() [1/4]

template<typename K, typename V>
std::vector<V> hazelcast::client::IMap< K, V >::values ( )
inline

Returns a vector clone of the values contained in this map.

The vector is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.

Returns
a vector clone of the values contained in this map

◆ values() [2/4]

template<typename K, typename V>
std::vector<V> hazelcast::client::IMap< K, V >::values ( const serialization::IdentifiedDataSerializable predicate)
inline
Deprecated:
This API is deprecated in favor of
See also
{values(const query::Predicate &predicate)}

Returns a vector clone of the values contained in this map. The vector is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.

Parameters
predicatethe criteria for values to match
Returns
a vector clone of the values contained in this map

◆ values() [3/4]

template<typename K, typename V>
std::vector<V> hazelcast::client::IMap< K, V >::values ( const query::Predicate predicate)
inline

Returns a vector clone of the values contained in this map.

The vector is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.

Parameters
predicatethe criteria for values to match
Returns
a vector clone of the values contained in this map

◆ values() [4/4]

template<typename K, typename V>
std::vector<V> hazelcast::client::IMap< K, V >::values ( query::PagingPredicate< K, V > &  predicate)
inline

Returns a vector clone of the values contained in this map.

The vector is NOT backed by the map, so changes to the map are NOT reflected in the collection, and vice-versa.

Parameters
predicatethe criteria for values to match
Returns
a vector clone of the values contained in this map

The documentation for this class was generated from the following file: