Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
IMap.h
1 /*
2  * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_IMAP
17 #define HAZELCAST_IMAP
18 
19 #include <string>
20 #include <map>
21 #include <set>
22 #include <vector>
23 #include <stdexcept>
24 #include <climits>
25 #include "hazelcast/client/protocol/codec/MapAddEntryListenerWithPredicateCodec.h"
26 #include "hazelcast/client/impl/EntryArrayImpl.h"
27 #include "hazelcast/client/proxy/IMapImpl.h"
28 #include "hazelcast/client/impl/EntryEventHandler.h"
29 #include "hazelcast/client/EntryListener.h"
30 #include "hazelcast/client/EntryView.h"
31 
32 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
33 #pragma warning(push)
34 #pragma warning(disable: 4251) //for dll export
35 #endif
36 
37 namespace hazelcast {
38  namespace client {
39  namespace adaptor {
40  template <typename K, typename V>
41  class RawPointerMap;
42  }
43 
57  template<typename K, typename V>
58  class IMap : public proxy::IMapImpl {
59  friend class HazelcastClient;
60  friend class adaptor::RawPointerMap<K, V>;
61 
62  public:
63 
70  bool containsKey(const K &key) {
71  return proxy::IMapImpl::containsKey(toData(key));
72  }
73 
80  bool containsValue(const V &value) {
81  return proxy::IMapImpl::containsValue(toData(value));
82  }
83 
91  boost::shared_ptr<V> get(const K &key) {
92  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::getData(toData(key))));
93  }
94 
103  boost::shared_ptr<V> put(const K &key, const V &value) {
104  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::putData(toData(key), toData(value))));
105  }
106 
114  boost::shared_ptr<V> remove(const K &key) {
115  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::removeData(toData(key))));
116  }
117 
125  bool remove(const K &key, const V &value) {
126  return proxy::IMapImpl::remove(toData(key), toData(value));
127  }
128 
135  void deleteEntry(const K &key) {
136  proxy::IMapImpl::deleteEntry(toData(key));
137  }
138 
143  void flush() {
144  proxy::IMapImpl::flush();
145  }
146 
157  bool tryRemove(const K &key, long timeoutInMillis) {
158  return proxy::IMapImpl::tryRemove(toData(key), timeoutInMillis);
159  }
160 
173  bool tryPut(const K &key, const V &value, long timeoutInMillis) {
174  return proxy::IMapImpl::tryPut(toData(key), toData(value), timeoutInMillis);
175  }
176 
188  boost::shared_ptr<V> put(const K &key, const V &value, long ttlInMillis) {
189  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::putData(toData(key), toData(value), ttlInMillis)));
190  }
191 
201  void putTransient(const K &key, const V &value, long ttlInMillis) {
202  proxy::IMapImpl::putTransient(toData(key), toData(value), ttlInMillis);
203  }
204 
213  boost::shared_ptr<V> putIfAbsent(const K &key, const V &value) {
214  return putIfAbsent(key, value, -1);
215  }
216 
228  boost::shared_ptr<V> putIfAbsent(const K &key, const V &value, long ttlInMillis) {
229  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::putIfAbsentData(toData(key), toData(value), ttlInMillis)));
230  }
231 
239  bool replace(const K &key, const V &oldValue, const V &newValue) {
240  return proxy::IMapImpl::replace(toData(key), toData(oldValue), toData(newValue));
241  }
242 
250  boost::shared_ptr<V> replace(const K &key, const V &value) {
251  return boost::shared_ptr<V>(toObject<V>(proxy::IMapImpl::replaceData(toData(key), toData(value))));
252  }
253 
263  void set(const K &key, const V &value, long ttl) {
264  proxy::IMapImpl::set(toData(key), toData(value), ttl);
265  }
266 
281  void lock(const K &key) {
282  proxy::IMapImpl::lock(toData(key));
283  }
284 
303  void lock(const K &key, long leaseTime) {
304  proxy::IMapImpl::lock(toData(key), leaseTime);
305  }
306 
315  bool isLocked(const K &key) {
316  return proxy::IMapImpl::isLocked(toData(key));
317  }
318 
328  bool tryLock(const K &key) {
329  return tryLock(key, 0);
330  }
331 
348  bool tryLock(const K &key, long timeInMillis) {
349  return proxy::IMapImpl::tryLock(toData(key), timeInMillis);
350  }
351 
365  void unlock(const K &key) {
366  proxy::IMapImpl::unlock(toData(key));
367  }
368 
377  void forceUnlock(const K &key) {
378  proxy::IMapImpl::forceUnlock(toData(key));
379  }
380 
392  template<typename MapInterceptor>
393  std::string addInterceptor(MapInterceptor &interceptor) {
394  return proxy::IMapImpl::addInterceptor(interceptor);
395  }
396 
403  void removeInterceptor(const std::string &id) {
404  proxy::IMapImpl::removeInterceptor(id);
405  }
406 
421  std::string addEntryListener(EntryListener<K, V> &listener, bool includeValue) {
422  impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
423  new impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler>(
424  getName(), context->getClusterService(), context->getSerializationService(), listener,
425  includeValue);
426  return proxy::IMapImpl::addEntryListener(entryEventHandler, includeValue);
427  }
428 
444  std::string addEntryListener(EntryListener<K, V> &listener, const query::Predicate &predicate, bool includeValue) {
445  impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerWithPredicateCodec::AbstractEventHandler> *entryEventHandler =
446  new impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerWithPredicateCodec::AbstractEventHandler>(
447  getName(), context->getClusterService(), context->getSerializationService(), listener,
448  includeValue);
449  return proxy::IMapImpl::addEntryListener(entryEventHandler, predicate, includeValue);
450  }
451 
461  bool removeEntryListener(const std::string &registrationId) {
462  return proxy::IMapImpl::removeEntryListener(registrationId);
463  }
464 
465 
479  std::string addEntryListener(EntryListener<K, V> &listener, const K &key, bool includeValue) {
480  serialization::pimpl::Data keyData = toData(key);
481  impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
482  new impl::EntryEventHandler<K, V, protocol::codec::MapAddEntryListenerCodec::AbstractEventHandler>(
483  getName(), context->getClusterService(), context->getSerializationService(), listener,
484  includeValue);
485  return proxy::IMapImpl::addEntryListener(entryEventHandler, keyData, includeValue);
486  }
487 
497  serialization::pimpl::Data keyData = toData(key);
498  std::auto_ptr<map::DataEntryView> dataEntryView = proxy::IMapImpl::getEntryViewData(keyData);
499  std::auto_ptr<V> v = toObject<V>(dataEntryView->getValue());
500  EntryView<K, V> view(key, *v, *dataEntryView);
501  return view;
502  }
503 
514  bool evict(const K &key) {
515  return proxy::IMapImpl::evict(toData(key));
516  }
517 
529  void evictAll() {
530  proxy::IMapImpl::evictAll();
531  }
532 
539  std::map<K, V> getAll(const std::set<K> &keys) {
540  std::vector<serialization::pimpl::Data> keySet(keys.size());
541  size_t i = 0;
542  for (typename std::set<K>::iterator it = keys.begin(); it != keys.end(); ++it) {
543  keySet[i++] = toData(*it);
544  }
545  std::map<K, V> result;
546  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > entrySet = proxy::IMapImpl::getAllData(
547  keySet);
548  for (std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> >::const_iterator it = entrySet.begin();
549  it != entrySet.end(); ++it) {
550  std::auto_ptr<K> key = toObject<K>(it->first);
551  std::auto_ptr<V> value = toObject<V>(it->second);
552  result[*key] = *value;
553  }
554  return result;
555  }
556 
564  std::vector<K> keySet() {
565  std::vector<serialization::pimpl::Data> dataResult = proxy::IMapImpl::keySetData();
566  size_t size = dataResult.size();
567  std::vector<K> keys(size);
568  for (size_t i = 0; i < size; ++i) {
569  std::auto_ptr<K> key = toObject<K>(dataResult[i]);
570  keys[i] = *key;
571  }
572  return keys;
573  }
574 
587  std::vector<K> keySet(const serialization::IdentifiedDataSerializable &predicate) {
588  const query::Predicate *p = (const query::Predicate *)(&predicate);
589  return keySet(*p);
590  }
591 
603  std::vector<K> keySet(const query::Predicate &predicate) {
604  std::vector<serialization::pimpl::Data> dataResult = proxy::IMapImpl::keySetData(predicate);
605  size_t size = dataResult.size();
606  std::vector<K> keys(size);
607  for (size_t i = 0; i < size; ++i) {
608  std::auto_ptr<K> key = toObject<K>(dataResult[i]);
609  keys[i] = *key;
610  }
611  return keys;
612  }
613 
625  std::vector<K> keySet(query::PagingPredicate<K, V> &predicate) {
626  predicate.setIterationType(query::KEY);
627 
628  std::vector<serialization::pimpl::Data> dataResult = keySetForPagingPredicateData(predicate);
629 
630  EntryVector entryResult;
631  for (std::vector<serialization::pimpl::Data>::iterator it = dataResult.begin();it != dataResult.end(); ++it) {
632  entryResult.push_back(std::pair<serialization::pimpl::Data, serialization::pimpl::Data>(*it, serialization::pimpl::Data()));
633  }
634 
635  impl::EntryArrayImpl<K, V> entries(entryResult, context->getSerializationService());
636  entries.sort(query::KEY, predicate.getComparator());
637 
638  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::KEY);
639 
640  std::vector<K> result;
641  for (size_t i = range.first; i < range.second; ++i) {
642  result.push_back(*entries.getKey(i));
643  }
644 
645  return result;
646  }
647 
655  std::vector<V> values() {
656  std::vector<serialization::pimpl::Data> dataResult = proxy::IMapImpl::valuesData();
657  size_t size = dataResult.size();
658  std::vector<K> values(size);
659  for (size_t i = 0; i < size; ++i) {
660  std::auto_ptr<K> value = toObject<K>(dataResult[i]);
661  values[i] = *value;
662  }
663  return values;
664  }
665 
676  std::vector<V> values(const serialization::IdentifiedDataSerializable &predicate) {
677  const query::Predicate *p = (const query::Predicate *)(&predicate);
678  return values(*p);
679  }
680 
689  std::vector<V> values(const query::Predicate &predicate) {
690  std::vector<serialization::pimpl::Data> dataResult = proxy::IMapImpl::valuesData(predicate);
691  size_t size = dataResult.size();
692  std::vector<V> values(size);
693  for (size_t i = 0; i < size; ++i) {
694  std::auto_ptr<V> value = toObject<V>(dataResult[i]);
695  values[i] = *value;
696  }
697  return values;
698  }
699 
709  std::vector<V> values(query::PagingPredicate<K, V> &predicate) {
710  predicate.setIterationType(query::VALUE);
711 
712  EntryVector dataResult = proxy::IMapImpl::valuesForPagingPredicateData(predicate);
713 
714  impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
715 
716  entries.sort(query::VALUE, predicate.getComparator());
717 
718  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::VALUE);
719 
720  std::vector<V> result;
721  for (size_t i = range.first; i < range.second; ++i) {
722  result.push_back(*entries.getValue(i));
723  }
724  return result;
725  }
726 
734  std::vector<std::pair<K, V> > entrySet() {
735  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult = proxy::IMapImpl::entrySetData();
736  size_t size = dataResult.size();
737  std::vector<std::pair<K, V> > entries(size);
738  for (size_t i = 0; i < size; ++i) {
739  std::auto_ptr<K> key = toObject<K>(dataResult[i].first);
740  std::auto_ptr<V> value = toObject<V>(dataResult[i].second);
741  entries[i] = std::make_pair(*key, *value);
742  }
743  return entries;
744  }
745 
758  std::vector<std::pair<K, V> > entrySet(const serialization::IdentifiedDataSerializable &predicate) {
759  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult = proxy::IMapImpl::entrySetData(
760  predicate);
761  size_t size = dataResult.size();
762  std::vector<std::pair<K, V> > entries(size);
763  for (size_t i = 0; i < size; ++i) {
764  std::auto_ptr<K> key = toObject<K>(dataResult[i].first);
765  std::auto_ptr<V> value = toObject<V>(dataResult[i].second);
766  entries[i] = std::make_pair(*key, *value);
767  }
768  return entries;
769  }
770 
781  std::vector<std::pair<K, V> > entrySet(const query::Predicate &predicate) {
782  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult = proxy::IMapImpl::entrySetData(
783  predicate);
784  size_t size = dataResult.size();
785  std::vector<std::pair<K, V> > entries(size);
786  for (size_t i = 0; i < size; ++i) {
787  std::auto_ptr<K> key = toObject<K>(dataResult[i].first);
788  std::auto_ptr<V> value = toObject<V>(dataResult[i].second);
789  entries[i] = std::make_pair(*key, *value);
790  }
791  return entries;
792  }
793 
804  std::vector<std::pair<K, V> > entrySet(query::PagingPredicate<K, V> &predicate) {
805  std::vector<std::pair<serialization::pimpl::Data, serialization::pimpl::Data> > dataResult = proxy::IMapImpl::entrySetForPagingPredicateData(
806  predicate);
807 
808  impl::EntryArrayImpl<K, V> entries(dataResult, context->getSerializationService());
809  entries.sort(query::ENTRY, predicate.getComparator());
810 
811  std::pair<size_t, size_t> range = updateAnchor<K, V>(entries, predicate, query::ENTRY);
812 
813  std::vector<std::pair<K, V> > result;
814  for (size_t i = range.first; i < range.second; ++i) {
815  std::pair<const K *, const V *> entry = entries[i];
816  result.push_back(std::pair<K, V>(*entry.first, *entry.second));
817  }
818  return result;
819  }
820 
853  void addIndex(const std::string &attribute, bool ordered) {
854  proxy::IMapImpl::addIndex(attribute, ordered);
855  }
856 
871  template<typename ResultType, typename EntryProcessor>
872  boost::shared_ptr<ResultType> executeOnKey(const K &key, EntryProcessor &entryProcessor) {
873  std::auto_ptr<serialization::pimpl::Data> resultData = proxy::IMapImpl::executeOnKeyData<K, EntryProcessor>(key, entryProcessor);
874 
875  return boost::shared_ptr<ResultType>(toObject<ResultType>(resultData));
876  }
877 
891  template<typename ResultType, typename EntryProcessor>
892  std::map<K, boost::shared_ptr<ResultType> > executeOnEntries(EntryProcessor &entryProcessor) {
893  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor);
894  std::map<K, boost::shared_ptr<ResultType> > result;
895  for (size_t i = 0; i < entries.size(); ++i) {
896  std::auto_ptr<K> keyObj = toObject<K>(entries[i].first);
897  std::auto_ptr<ResultType> resObj = toObject<ResultType>(entries[i].second);
898  result[*keyObj] = resObj;
899  }
900  return result;
901  }
902 
920  template<typename ResultType, typename EntryProcessor>
921  std::map<K, boost::shared_ptr<ResultType> > executeOnEntries(EntryProcessor &entryProcessor, const serialization::IdentifiedDataSerializable &predicate) {
922  const query::Predicate *p = (const query::Predicate *)(&predicate);
923  return executeOnEntries<ResultType, EntryProcessor>(entryProcessor, *p);
924  }
925 
940  template<typename ResultType, typename EntryProcessor>
941  std::map<K, boost::shared_ptr<ResultType> > executeOnEntries(EntryProcessor &entryProcessor, const query::Predicate &predicate) {
942  EntryVector entries = proxy::IMapImpl::executeOnEntriesData<EntryProcessor>(entryProcessor, predicate);
943  std::map<K, boost::shared_ptr<ResultType> > result;
944  for (size_t i = 0; i < entries.size(); ++i) {
945  std::auto_ptr<K> keyObj = toObject<K>(entries[i].first);
946  std::auto_ptr<ResultType> resObj = toObject<ResultType>(entries[i].second);
947  result[*keyObj] = resObj;
948  }
949  return result;
950  }
951 
959  void set(const K &key, const V &value) {
960  set(key, value, -1);
961  }
962 
970  int size() {
971  return proxy::IMapImpl::size();
972  }
973 
979  bool isEmpty() {
980  return proxy::IMapImpl::isEmpty();
981  }
982 
983 
994  void putAll(const std::map<K, V> &entries) {
995  return proxy::IMapImpl::putAll(toDataEntries(entries));
996  }
997 
1002  void clear() {
1003  proxy::IMapImpl::clear();
1004  }
1005 
1006  private:
1007  IMap(const std::string &instanceName, spi::ClientContext *context)
1008  : proxy::IMapImpl(instanceName, context) {
1009  }
1010  };
1011  }
1012 }
1013 
1014 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1015 #pragma warning(pop)
1016 #endif
1017 
1018 #endif /* HAZELCAST_IMAP */
1019 
void putTransient(const K &key, const V &value, long ttlInMillis)
Same as put(K, V, long, TimeUnit) but MapStore, if defined, will not be called to store/persist the e...
Definition: IMap.h:201
std::vector< std::pair< K, V > > entrySet()
Returns a std::vector< std::pair<K, V> > clone of the mappings contained in this map.
Definition: IMap.h:734
boost::shared_ptr< V > putIfAbsent(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value if the specified key is not already...
Definition: IMap.h:228
std::map< K, V > getAll(const std::set< K > &keys)
Returns the entries for the given keys.
Definition: IMap.h:539
void putAll(const std::map< K, V > &entries)
Copies all of the mappings from the specified map to this map (optional operation).
Definition: IMap.h:994
boost::shared_ptr< V > replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value.
Definition: IMap.h:250
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: IMap.h:328
Map Entry listener to get notified when a map entry is added, removed, updated or evicted...
Definition: EntryListener.h:45
bool tryLock(const K &key, long timeInMillis)
Tries to acquire the lock for the specified key.
Definition: IMap.h:348
bool tryPut(const K &key, const V &value, long timeoutInMillis)
Tries to put the given key, value into this map within specified timeout value.
Definition: IMap.h:173
void set(const K &key, const V &value)
Puts an entry into this map.
Definition: IMap.h:959
std::vector< V > values(const query::Predicate &predicate)
Returns a vector clone of the values contained in this map.
Definition: IMap.h:689
std::vector< V > values()
Returns a vector clone of the values contained in this map.
Definition: IMap.h:655
void deleteEntry(const K &key)
removes entry from map.
Definition: IMap.h:135
void evictAll()
Evicts all keys from this map except locked ones.
Definition: IMap.h:529
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: IMap.h:892
std::string addEntryListener(EntryListener< K, V > &listener, bool includeValue)
Adds an entry listener for this map.
Definition: IMap.h:421
std::vector< K > keySet()
Returns a vector clone of the keys contained in this map.
Definition: IMap.h:564
void set(const K &key, const V &value, long ttl)
Puts an entry into this map.
Definition: IMap.h:263
std::string addEntryListener(EntryListener< K, V > &listener, const K &key, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: IMap.h:479
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.
Definition: IMap.h:804
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.
Definition: IMap.h:239
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor, const query::Predicate &predicate)
Applies the user defined EntryProcessor to the all entries in the map.
Definition: IMap.h:941
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...
Definition: IMap.h:213
Classes that will be used with hazelcast data structures like IMap, IQueue etc should either inherit ...
Definition: IdentifiedDataSerializable.h:42
NOTE: PagingPredicate can only be used with values(), keySet() and entries() methods!!! ...
Definition: PagingPredicate.h:127
void addIndex(const std::string &attribute, bool ordered)
Adds an index to this map for the specified entries so that queries can run faster.
Definition: IMap.h:853
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: IMap.h:315
std::vector< K > keySet(const query::Predicate &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries...
Definition: IMap.h:603
boost::shared_ptr< V > put(const K &key, const V &value, long ttlInMillis)
Puts an entry into this map with a given ttl (time to live) value.
Definition: IMap.h:188
void flush()
If this map has a MapStore this method flushes all the local dirty entries by calling MapStore...
Definition: IMap.h:143
std::string addInterceptor(MapInterceptor &interceptor)
Adds an interceptor for this map.
Definition: IMap.h:393
std::map< K, boost::shared_ptr< ResultType > > executeOnEntries(EntryProcessor &entryProcessor, const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:921
Adaptor class to IMap which provides releasable raw pointers for returned objects.
Definition: RawPointerMap.h:50
void lock(const K &key)
Acquires the lock for the specified key.
Definition: IMap.h:281
bool tryRemove(const K &key, long timeoutInMillis)
Tries to remove the entry with the given key from this map within specified timeout value...
Definition: IMap.h:157
void lock(const K &key, long leaseTime)
Acquires the lock for the specified key for the specified lease time.
Definition: IMap.h:303
void removeInterceptor(const std::string &id)
Removes the given interceptor for this map.
Definition: IMap.h:403
std::string addEntryListener(EntryListener< K, V > &listener, const query::Predicate &predicate, bool includeValue)
Adds an entry listener for this map.
Definition: IMap.h:444
This is a merker class for Predicate classes.
Definition: Predicate.h:36
std::vector< std::pair< K, V > > entrySet(const query::Predicate &predicate)
Queries the map based on the specified predicate and returns the matching entries.
Definition: IMap.h:781
EntryView represents a readonly view of a map entry.
Definition: EntryView.h:39
std::vector< K > keySet(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:587
Concurrent, distributed, observable and queryable map client.
Definition: IMap.h:58
bool isEmpty()
Returns true if this map contains no key-value mappings.
Definition: IMap.h:979
void unlock(const K &key)
Releases the lock for the specified key.
Definition: IMap.h:365
bool evict(const K &key)
Evicts the specified key from this map.
Definition: IMap.h:514
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: IMap.h:377
std::vector< V > values(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:676
void clear()
Removes all of the mappings from this map (optional operation).
Definition: IMap.h:1002
std::vector< V > values(query::PagingPredicate< K, V > &predicate)
Returns a vector clone of the values contained in this map.
Definition: IMap.h:709
boost::shared_ptr< V > put(const K &key, const V &value)
put new entry into map.
Definition: IMap.h:103
EntryView< K, V > getEntryView(const K &key)
Returns the EntryView for the specified key.
Definition: IMap.h:496
bool containsValue(const V &value)
check if this map contains value.
Definition: IMap.h:80
std::vector< K > keySet(query::PagingPredicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries...
Definition: IMap.h:625
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:453
bool containsKey(const K &key)
check if this map contains key.
Definition: IMap.h:70
std::vector< std::pair< K, V > > entrySet(const serialization::IdentifiedDataSerializable &predicate)
Definition: IMap.h:758
bool removeEntryListener(const std::string &registrationId)
Removes the specified entry listener Returns silently if there is no such listener added before...
Definition: IMap.h:461
int size()
Returns the number of key-value mappings in this map.
Definition: IMap.h:970
boost::shared_ptr< ResultType > executeOnKey(const K &key, EntryProcessor &entryProcessor)
Applies the user defined EntryProcessor to the entry mapped by the key.
Definition: IMap.h:872