16 #ifndef HAZELCAST_CLIENT_MIXEDTYPE_MULTIMAP_H_
17 #define HAZELCAST_CLIENT_MIXEDTYPE_MULTIMAP_H_
19 #include "hazelcast/client/proxy/MultiMapImpl.h"
20 #include "hazelcast/client/impl/EntryEventHandler.h"
21 #include "hazelcast/client/protocol/codec/MultiMapAddEntryListenerCodec.h"
36 class HAZELCAST_API
MultiMap :
public proxy::MultiMapImpl {
49 template <
typename K,
typename V>
50 bool put(
const K &key,
const V &value) {
51 return proxy::MultiMapImpl::put(toData(key), toData(value));
61 std::vector<TypedData>
get(
const K &key) {
62 return toTypedDataCollection(proxy::MultiMapImpl::getData(toData(key)));
72 template <
typename K,
typename V>
73 bool remove(
const K &key,
const V &value) {
74 return proxy::MultiMapImpl::remove(toData(key), toData(value));
85 std::vector<TypedData>
remove(
const K &key) {
86 return toTypedDataCollection(proxy::MultiMapImpl::removeData(toData(key)));
95 std::vector<TypedData> keySet();
103 std::vector<TypedData> values();
111 std::vector<std::pair<TypedData, TypedData> > entrySet();
119 template <
typename K>
121 return proxy::MultiMapImpl::containsKey(toData(key));
130 template <
typename V>
132 return proxy::MultiMapImpl::containsValue(toData(value));
142 template <
typename K,
typename V>
144 return proxy::MultiMapImpl::containsEntry(toData(key), toData(value));
166 template <
typename K>
168 return proxy::MultiMapImpl::valueCount(toData(key));
203 template <
typename K>
205 impl::MixedEntryEventHandler<protocol::codec::MultiMapAddEntryListenerCodec::AbstractEventHandler> *entryEventHandler =
206 new impl::MixedEntryEventHandler<protocol::codec::MultiMapAddEntryListenerCodec::AbstractEventHandler>(
207 getName(), context->getClusterService(), context->getSerializationService(), listener,
209 return proxy::MultiMapImpl::addEntryListener(entryEventHandler, toData(key), includeValue);
220 bool removeEntryListener(
const std::string ®istrationId);
236 template <
typename K>
238 proxy::MultiMapImpl::lock(toData(key));
257 template <
typename K>
258 void lock(
const K &key,
long leaseTimeInMillis) {
259 proxy::MultiMapImpl::lock(toData(key), leaseTimeInMillis);
269 template <
typename K>
271 return proxy::MultiMapImpl::isLocked(toData(key));
283 template <
typename K>
285 return proxy::MultiMapImpl::tryLock(toData(key));
304 template <
typename K>
305 bool tryLock(
const K &key,
long timeoutInMillis) {
306 return proxy::MultiMapImpl::tryLock(toData(key), timeoutInMillis);
316 template <
typename K>
318 proxy::MultiMapImpl::unlock(toData(key));
327 template <
typename K>
329 proxy::MultiMapImpl::forceUnlock(toData(key));
333 MultiMap(
const std::string &instanceName, spi::ClientContext *context);
void lock(const K &key, long leaseTimeInMillis)
Acquires the lock for the specified key for the specified lease time.
Definition: MultiMap.h:258
bool containsEntry(const K &key, const V &value)
Returns whether the multimap contains the given key-value pair.
Definition: MultiMap.h:143
void unlock(const K &key)
Releases the lock for the specified key.
Definition: MultiMap.h:317
bool isLocked(const K &key)
Checks the lock for the specified key.
Definition: MultiMap.h:270
void forceUnlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
Definition: MultiMap.h:328
bool containsKey(const K &key)
Returns whether the multimap contains an entry with the key.
Definition: MultiMap.h:120
Definition: EntryListener.h:108
bool tryLock(const K &key)
Tries to acquire the lock for the specified key.
Definition: MultiMap.h:284
int valueCount(const K &key)
Returns number of values matching to given key in the multimap.
Definition: MultiMap.h:167
bool tryLock(const K &key, long timeoutInMillis)
Tries to acquire the lock for the specified key.
Definition: MultiMap.h:305
bool put(const K &key, const V &value)
Stores a key-value pair in the multimap.
Definition: MultiMap.h:50
std::string addEntryListener(MixedEntryListener &listener, const K &key, bool includeValue)
Adds the specified entry listener for the specified key.
Definition: MultiMap.h:204
A specialized distributed map client whose keys can be associated with multiple values.
Definition: MultiMap.h:36
void lock(const K &key)
Acquires the lock for the specified key.
Definition: MultiMap.h:237
Definition: MapEntryView.h:32
bool containsValue(const V &value)
Returns whether the multimap contains an entry with the value.
Definition: MultiMap.h:131
Hazelcast Client enables you to do all Hazelcast operations without being a member of the cluster...
Definition: HazelcastClient.h:459