Hazelcast C++ Client
|
A specialized distributed map client whose keys can be associated with multiple values. More...
#include <multi_map.h>
Public Member Functions | |
template<typename K , typename V > | |
boost::future< bool > | put (const K &key, const V &value) |
Stores a key-value pair in the multimap. More... | |
template<typename K , typename V > | |
boost::future< std::vector< V > > | get (const K &key) |
Returns the multimap of values associated with the key. More... | |
template<typename K , typename V > | |
boost::future< bool > | remove (const K &key, const V &value) |
Removes the given key value pair from the multimap. More... | |
template<typename K , typename V > | |
boost::future< std::vector< V > > | remove (const K &key) |
Removes all the entries with the given key. More... | |
template<typename K > | |
boost::future< std::vector< K > > | key_set () |
Returns the set of keys in the multimap. More... | |
template<typename V > | |
boost::future< std::vector< V > > | values () |
Returns the multimap of values in the multimap. More... | |
template<typename K , typename V > | |
boost::future< std::vector< std::pair< K, V > > > | entry_set () |
Returns the set of key-value pairs in the multimap. More... | |
template<typename K > | |
boost::future< bool > | contains_key (const K &key) |
Returns whether the multimap contains an entry with the key. More... | |
template<typename V > | |
boost::future< bool > | contains_value (const V &value) |
Returns whether the multimap contains an entry with the value. More... | |
template<typename K , typename V > | |
boost::future< bool > | contains_entry (const K &key, const V &value) |
Returns whether the multimap contains the given key-value pair. More... | |
template<typename K > | |
boost::future< int > | value_count (const K &key) |
Returns number of values matching to given key in the multimap. More... | |
boost::future< boost::uuids::uuid > | add_entry_listener (entry_listener &&listener, bool include_value) |
Adds an entry listener for this multimap. More... | |
template<typename K > | |
boost::future< boost::uuids::uuid > | add_entry_listener (entry_listener &&listener, const K &key, bool include_value) |
Adds the specified entry listener for the specified key. More... | |
template<typename K > | |
boost::future< void > | lock (const K &key) |
Acquires the lock for the specified key. More... | |
template<typename K > | |
boost::future< void > | lock (const K &key, std::chrono::milliseconds lease_time) |
Acquires the lock for the specified key for the specified lease time. More... | |
template<typename K > | |
boost::future< bool > | is_locked (const K &key) |
Checks the lock for the specified key. More... | |
template<typename K > | |
boost::future< bool > | try_lock (const K &key) |
Tries to acquire the lock for the specified key. More... | |
template<typename K > | |
boost::future< bool > | try_lock (const K &key, std::chrono::milliseconds timeout) |
Tries to acquire the lock for the specified key. More... | |
template<typename K > | |
boost::future< bool > | try_lock (const K &key, std::chrono::milliseconds timeout, std::chrono::milliseconds lease_time) |
Tries to acquire the lock for the specified key for the specified lease time. More... | |
template<typename K > | |
boost::future< void > | unlock (const K &key) |
Releases the lock for the specified key. More... | |
template<typename K > | |
boost::future< void > | force_unlock (const K &key) |
Releases the lock for the specified key regardless of the lock owner. More... | |
Static Public Attributes | |
static constexpr const char * | SERVICE_NAME = "hz:impl:multiMapService" |
Friends | |
class | spi::ProxyManager |
A specialized distributed map client whose keys can be associated with multiple values.
|
inline |
Adds an entry listener for this multimap.
Listener will get notified for all multimap add/remove/update/evict events.
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.
listener | entry listener |
includeValue | true if EntryEvent should contain the value. |
|
inline |
Adds the specified entry listener for the specified key.
The listener will get notified for all add/remove/update/evict events of the specified key only.
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.
listener | entry listener |
key | the key to listen |
includeValue | true if EntryEvent should contain the value. |
|
inline |
Returns whether the multimap contains the given key-value pair.
key | the key whose existence is checked. |
value | the value whose existence is checked. |
|
inline |
Returns whether the multimap contains an entry with the key.
key | the key whose existence is checked. |
|
inline |
Returns whether the multimap contains an entry with the value.
value | the value whose existence is checked. |
|
inline |
Returns the set of key-value pairs in the multimap.
|
inline |
Releases the lock for the specified key regardless of the lock owner.
It always successfully unlocks the key, never blocks and returns immediately.
key | key to lock. |
|
inline |
Returns the multimap of values associated with the key.
key | the key whose associated values are to be returned |
|
inline |
Checks the lock for the specified key.
If the lock is acquired then returns true, else false.
key | key to lock to be checked. |
true
if lock is acquired, false
otherwise.
|
inline |
Returns the set of keys in the multimap.
|
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 multimap only. Acquired lock is only for the key in this multimap.
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.
key | key to lock. |
|
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.
key | key to lock. |
leaseTime | time to wait before releasing the lock. |
|
inline |
Stores a key-value pair in the multimap.
key | the key to be stored |
value | the value to be stored |
|
inline |
Removes the given key value pair from the multimap.
key | |
value |
|
inline |
Removes all the entries with the given key.
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.
key | key to lock. |
true
if lock is acquired, false
otherwise.
|
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:
key | to be locked. |
timeout | the maximum time to wait for the lock |
true
if the lock was acquired and false
if the waiting time elapsed before the lock was acquired.
|
inline |
Tries to acquire the lock for the specified key for the specified lease time.
After lease time, the lock will be released.
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:
key | to be locked. |
timeout | the maximum time to wait for the lock |
leaseTime | time to wait before releasing the lock. |
true
if the lock was acquired and false
if the waiting time elapsed before the lock was acquired.
|
inline |
Releases the lock for the specified key.
It never blocks and returns immediately.
key | key to lock. |
|
inline |
Returns number of values matching to given key in the multimap.
key | the key whose values count are to be returned |
|
inline |
Returns the multimap of values in the multimap.