19 #include <unordered_map>
20 #include <unordered_set>
26 #include <boost/container/vector.hpp>
28 #include "hazelcast/client/monitor/local_map_stats.h"
29 #include "hazelcast/client/monitor/impl/NearCacheStatsImpl.h"
30 #include "hazelcast/client/monitor/impl/LocalMapStatsImpl.h"
31 #include "hazelcast/client/proxy/IMapImpl.h"
32 #include "hazelcast/client/impl/EntryEventHandler.h"
33 #include "hazelcast/client/entry_listener.h"
34 #include "hazelcast/client/serialization/serialization.h"
35 #include "hazelcast/util/exception_util.h"
36 #include "hazelcast/client/protocol/codec/codecs.h"
37 #include "hazelcast/client/spi/ClientContext.h"
39 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
41 #pragma warning(disable : 4251)
46 class hazelcast_client;
62 class HAZELCAST_API
imap :
public proxy::IMapImpl
64 friend class spi::ProxyManager;
67 static constexpr
const char* SERVICE_NAME =
"hz:impl:mapService";
69 imap(
const std::string& instance_name, spi::ClientContext* context)
70 : proxy::IMapImpl(instance_name, context)
81 return contains_key_internal(to_data(key));
92 return proxy::IMapImpl::contains_value(to_data(value));
101 template<
typename K,
typename V>
102 boost::future<boost::optional<V>>
get(
const K& key)
104 return to_object<V>(get_internal(to_data(key)));
114 template<
typename K,
typename V,
typename R = V>
115 boost::future<boost::optional<R>>
put(
const K& key,
const V& value)
117 return put<K, V, R>(key, value, UNSET);
132 template<
typename K,
typename V,
typename R = V>
133 boost::future<boost::optional<R>>
put(
const K& key,
135 std::chrono::milliseconds ttl)
137 return to_object<R>(put_internal(to_data(key), to_data(value), ttl));
146 template<
typename K,
typename V>
147 boost::future<boost::optional<V>>
remove(
const K& key)
149 return to_object<V>(remove_internal(to_data(key)));
159 template<
typename K,
typename V>
160 boost::future<bool>
remove(
const K& key,
const V& value)
162 return remove_internal(to_data(key), to_data(value));
179 return to_void_future(remove_all_internal(to_data<P>(predicate)));
190 return to_void_future(delete_internal(to_data(key)));
204 std::chrono::milliseconds timeout)
206 return try_remove_internal(to_data(key), timeout);
221 template<
typename K,
typename V>
224 std::chrono::milliseconds timeout)
226 return try_put_internal(to_data(key), to_data(value), timeout);
239 template<
typename K,
typename V>
242 std::chrono::milliseconds ttl)
244 return to_void_future(
245 try_put_transient_internal(to_data(key), to_data(value), ttl));
257 template<
typename K,
typename V,
typename R = V>
261 return put_if_absent(key, value, UNSET);
275 template<
typename K,
typename V,
typename R = V>
276 boost::future<boost::optional<V>>
280 put_if_absent_internal(to_data(key), to_data(value), ttl));
290 template<
typename K,
typename V,
typename N = V>
295 return replace_if_same_internal(
296 to_data(key), to_data(old_value), to_data(new_value));
306 template<
typename K,
typename V,
typename R = V>
307 boost::future<boost::optional<R>>
replace(
const K& key,
const V& value)
309 return to_object<R>(replace_internal(to_data(key), to_data(value)));
319 template<
typename K,
typename V,
typename R = V>
320 boost::future<void>
set(
const K& key,
const V& value)
322 return to_void_future(set(key, value, UNSET));
334 template<
typename K,
typename V>
335 boost::future<void>
set(
const K& key,
337 std::chrono::milliseconds ttl)
339 return to_void_future(set_internal(to_data(key), to_data(value), ttl));
357 boost::future<void>
lock(
const K& key)
359 return to_void_future(lock(key, UNSET));
381 boost::future<void>
lock(
const K& key, std::chrono::milliseconds lease_time)
383 return to_void_future(proxy::IMapImpl::lock(to_data(key), lease_time));
397 return proxy::IMapImpl::is_locked(to_data(key));
412 return try_lock(key, std::chrono::milliseconds(0));
433 std::chrono::milliseconds timeout)
435 return proxy::IMapImpl::try_lock(to_data(key), timeout);
457 std::chrono::milliseconds timeout,
458 std::chrono::milliseconds lease_time)
460 return proxy::IMapImpl::try_lock(to_data(key), timeout, lease_time);
480 return to_void_future(proxy::IMapImpl::unlock(to_data(key)));
494 return to_void_future(proxy::IMapImpl::force_unlock(to_data(key)));
509 template<
typename MapInterceptor>
511 const MapInterceptor& interceptor)
513 return proxy::IMapImpl::add_interceptor(to_data(interceptor));
535 const auto listener_flags = listener.flags_;
536 return proxy::IMapImpl::add_entry_listener(
537 std::unique_ptr<impl::BaseEventHandler>(
538 new impl::EntryEventHandler<
539 protocol::codec::map_addentrylistener_handler>(
541 get_context().get_client_cluster_service(),
542 get_context().get_serialization_service(),
545 get_context().get_logger())),
573 const auto listener_flags = listener.flags_;
574 return proxy::IMapImpl::add_entry_listener(
575 std::unique_ptr<impl::BaseEventHandler>(
576 new impl::EntryEventHandler<
577 protocol::codec::map_addentrylistenerwithpredicate_handler>(
579 get_context().get_client_cluster_service(),
580 get_context().get_serialization_service(),
583 get_context().get_logger())),
584 to_data<P>(predicate),
608 const auto listener_flags = listener.flags_;
609 return proxy::IMapImpl::add_entry_listener(
610 std::shared_ptr<impl::BaseEventHandler>(
611 new impl::EntryEventHandler<
612 protocol::codec::map_addentrylistenertokey_handler>(
614 get_context().get_client_cluster_service(),
615 get_context().get_serialization_service(),
618 get_context().get_logger())),
632 template<
typename K,
typename V>
636 auto f = proxy::IMapImpl::get_entry_view_data(to_data(key));
637 return to_object_entry_view<K, V>(std::move(f));
651 boost::future<bool>
evict(
const K& key)
653 return evict_internal(to_data(key));
662 template<
typename K,
typename V>
663 boost::future<std::unordered_map<K, V>>
get_all(
664 const std::unordered_set<K>& keys)
667 return boost::make_ready_future(std::unordered_map<K, V>());
670 std::unordered_map<int, std::vector<serialization::pimpl::data>>
671 partition_to_key_data;
673 for (
auto& key : keys) {
674 auto key_data = to_data<K>(key);
676 auto partitionId = get_partition_id(key_data);
677 partition_to_key_data[partitionId].push_back(std::move(key_data));
680 std::vector<boost::future<EntryVector>> futures;
681 futures.reserve(partition_to_key_data.size());
682 for (
auto& entry : partition_to_key_data) {
683 futures.push_back(get_all_internal(entry.first, entry.second));
686 return to_object_map<K, V>(futures);
700 return to_object_vector<K>(proxy::IMapImpl::key_set_data());
717 class =
typename std::enable_if<
718 !std::is_base_of<query::paging_predicate_marker, P>::value>::type>
719 boost::future<std::vector<K>>
key_set(
const P& predicate)
721 return to_object_vector<K>(
722 proxy::IMapImpl::key_set_data(to_data(predicate)));
736 template<
typename K,
typename V>
740 predicate.set_iteration_type(query::iteration_type::KEY);
741 auto future = key_set_for_paging_predicate_data(
742 protocol::codec::holder::paging_predicate_holder::of(
743 predicate, serialization_service_));
744 return keys_to_object_vector_with_predicate(std::move(future),
759 return to_object_vector<V>(proxy::IMapImpl::values_data());
774 class =
typename std::enable_if<
775 !std::is_base_of<query::paging_predicate_marker, P>::value>::type>
776 boost::future<std::vector<V>>
values(
const P& predicate)
778 return to_object_vector<V>(
779 proxy::IMapImpl::values_data(to_data(predicate)));
792 template<
typename K,
typename V>
796 predicate.set_iteration_type(query::iteration_type::VALUE);
797 auto future = values_for_paging_predicate_data(
798 protocol::codec::holder::paging_predicate_holder::of(
799 predicate, serialization_service_));
800 return values_to_object_vector_with_predicate(std::move(future),
811 template<
typename K,
typename V>
814 return to_entry_object_vector<K, V>(proxy::IMapImpl::entry_set_data());
831 class =
typename std::enable_if<
832 !std::is_base_of<query::paging_predicate_marker, P>::value>::type>
833 boost::future<std::vector<std::pair<K, V>>>
entry_set(
const P& predicate)
835 return to_entry_object_vector<K, V>(
836 proxy::IMapImpl::entry_set_data(to_data(predicate)));
849 template<
typename K,
typename V>
853 predicate.set_iteration_type(query::iteration_type::ENTRY);
854 auto future = entry_set_for_paging_predicate_data(
855 protocol::codec::holder::paging_predicate_holder::of(
856 predicate, serialization_service_));
857 return entry_set_to_object_vector_with_predicate<K, V>(
858 std::move(future), predicate);
903 return to_void_future(proxy::IMapImpl::add_index_data(config));
913 template<
typename... T>
921 boost::future<void> clear()
923 return to_void_future(proxy::IMapImpl::clear_data());
941 template<
typename K,
typename ResultType,
typename EntryProcessor>
944 const EntryProcessor& entry_processor)
946 return to_object<ResultType>(
947 execute_on_key_internal(to_data(key), to_data(entry_processor)));
959 template<
typename K,
typename ResultType,
typename EntryProcessor>
962 const EntryProcessor& entry_processor)
964 return to_object<ResultType>(
965 submit_to_key_internal(to_data(key), to_data(entry_processor)));
981 template<
typename K,
typename ResultType,
typename EntryProcessor>
982 boost::future<std::unordered_map<K, boost::optional<ResultType>>>
984 const EntryProcessor& entry_processor)
986 return to_object_map<K, ResultType>(
987 execute_on_keys_internal<K, EntryProcessor>(keys, entry_processor));
1003 template<
typename K,
typename ResultType,
typename EntryProcessor>
1004 boost::future<std::unordered_map<K, boost::optional<ResultType>>>
1007 return to_object_map<K, ResultType>(
1008 proxy::IMapImpl::execute_on_entries_data(to_data(entry_processor)));
1026 template<
typename K,
1027 typename ResultType,
1028 typename EntryProcessor,
1030 boost::future<std::unordered_map<K, boost::optional<ResultType>>>
1034 return to_object_map<K, ResultType>(
1035 proxy::IMapImpl::execute_on_entries_data(to_data(entry_processor),
1036 to_data(predicate)));
1049 template<
typename K,
typename V>
1050 boost::future<void>
put_all(
const std::unordered_map<K, V>& entries)
1052 std::unordered_map<int, EntryVector> entryMap;
1053 for (
auto& entry : entries) {
1054 serialization::pimpl::data key_data = to_data(entry.first);
1055 int partitionId = get_partition_id(key_data);
1056 entryMap[partitionId].push_back(
1057 std::make_pair(key_data, to_data(entry.second)));
1060 std::vector<boost::future<protocol::ClientMessage>> resultFutures;
1061 for (
auto&& partitionEntry : entryMap) {
1062 auto partitionId = partitionEntry.first;
1063 resultFutures.push_back(
1064 put_all_internal(partitionId, std::move(partitionEntry.second)));
1066 return boost::when_all(resultFutures.begin(), resultFutures.end())
1067 .then(boost::launch::sync,
1068 [](boost::future<boost::csbl::vector<
1069 boost::future<protocol::ClientMessage>>> futures) {
1070 for (
auto& f : futures.get()) {
1090 template<
typename K,
typename V>
1092 size_t predicate_page_size)
1095 predicate_page_size);
1098 template<
typename K,
typename V,
typename INNER_PREDICATE>
1099 query::paging_predicate<K, V> new_paging_predicate(
1100 size_t predicate_page_size,
1101 const INNER_PREDICATE& predicate)
1103 return query::paging_predicate<K, V>(
1104 get_serialization_service(), predicate_page_size, predicate);
1107 template<
typename K,
typename V,
typename COMPARATOR>
1108 query::paging_predicate<K, V> new_paging_predicate(
1109 COMPARATOR&& comparator,
1110 size_t predicate_page_size)
1112 return query::paging_predicate<K, V>(get_serialization_service(),
1113 std::move(comparator),
1114 predicate_page_size);
1117 template<
typename K,
1119 typename INNER_PREDICATE,
1120 typename COMPARATOR>
1121 query::paging_predicate<K, V> new_paging_predicate(
1122 const INNER_PREDICATE& predicate,
1123 COMPARATOR&& comparator,
1124 size_t predicate_page_size)
1126 return query::paging_predicate<K, V>(get_serialization_service(),
1128 std::move(comparator),
1129 predicate_page_size);
1136 static const std::chrono::milliseconds
UNSET;
1138 monitor::impl::LocalMapStatsImpl local_map_stats_;
1140 virtual boost::future<boost::optional<serialization::pimpl::data>>
1141 get_internal(
const serialization::pimpl::data& key_data)
1143 return proxy::IMapImpl::get_data(key_data);
1146 virtual boost::future<bool> contains_key_internal(
1147 const serialization::pimpl::data& key_data)
1149 return proxy::IMapImpl::contains_key(key_data);
1152 virtual boost::future<boost::optional<serialization::pimpl::data>>
1153 remove_internal(
const serialization::pimpl::data& key_data)
1155 return proxy::IMapImpl::remove_data(key_data);
1158 virtual boost::future<bool> remove_internal(
1159 const serialization::pimpl::data& key_data,
1160 const serialization::pimpl::data& value_data)
1162 return proxy::IMapImpl::remove(key_data, value_data);
1165 virtual boost::future<protocol::ClientMessage> remove_all_internal(
1166 const serialization::pimpl::data& predicate_data)
1168 return proxy::IMapImpl::remove_all(predicate_data);
1171 virtual boost::future<protocol::ClientMessage> delete_internal(
1172 const serialization::pimpl::data& key_data)
1174 return proxy::IMapImpl::delete_entry(key_data);
1177 virtual boost::future<bool> try_remove_internal(
1178 const serialization::pimpl::data& key_data,
1179 std::chrono::milliseconds timeout)
1181 return proxy::IMapImpl::try_remove(key_data, timeout);
1184 virtual boost::future<bool> try_put_internal(
1185 const serialization::pimpl::data& key_data,
1186 const serialization::pimpl::data& value_data,
1187 std::chrono::milliseconds timeout)
1189 return proxy::IMapImpl::try_put(key_data, value_data, timeout);
1192 virtual boost::future<boost::optional<serialization::pimpl::data>>
1193 put_internal(
const serialization::pimpl::data& key_data,
1194 const serialization::pimpl::data& value_data,
1195 std::chrono::milliseconds ttl)
1197 return proxy::IMapImpl::put_data(key_data, value_data, ttl);
1200 virtual boost::future<protocol::ClientMessage> try_put_transient_internal(
1201 const serialization::pimpl::data& key_data,
1202 const serialization::pimpl::data& value_data,
1203 std::chrono::milliseconds ttl)
1205 return proxy::IMapImpl::put_transient(key_data, value_data, ttl);
1208 virtual boost::future<boost::optional<serialization::pimpl::data>>
1209 put_if_absent_internal(
const serialization::pimpl::data& key_data,
1210 const serialization::pimpl::data& value_data,
1211 std::chrono::milliseconds ttl)
1213 return proxy::IMapImpl::put_if_absent_data(key_data, value_data, ttl);
1216 virtual boost::future<bool> replace_if_same_internal(
1217 const serialization::pimpl::data& key_data,
1218 const serialization::pimpl::data& value_data,
1219 const serialization::pimpl::data& new_value_data)
1221 return proxy::IMapImpl::replace(key_data, value_data, new_value_data);
1224 virtual boost::future<boost::optional<serialization::pimpl::data>>
1225 replace_internal(
const serialization::pimpl::data& key_data,
1226 const serialization::pimpl::data& value_data)
1228 return proxy::IMapImpl::replace_data(key_data, value_data);
1231 virtual boost::future<protocol::ClientMessage> set_internal(
1232 const serialization::pimpl::data& key_data,
1233 const serialization::pimpl::data& value_data,
1234 std::chrono::milliseconds ttl)
1236 return proxy::IMapImpl::set(key_data, value_data, ttl);
1239 virtual boost::future<bool> evict_internal(
1240 const serialization::pimpl::data& key_data)
1242 return proxy::IMapImpl::evict(key_data);
1245 virtual boost::future<EntryVector> get_all_internal(
1247 const std::vector<serialization::pimpl::data>& partition_keys)
1249 return proxy::IMapImpl::get_all_data(partition_id, partition_keys);
1252 virtual boost::future<boost::optional<serialization::pimpl::data>>
1253 execute_on_key_internal(
const serialization::pimpl::data& key_data,
1254 const serialization::pimpl::data& processor)
1256 return proxy::IMapImpl::execute_on_key_data(key_data, processor);
1259 boost::future<boost::optional<serialization::pimpl::data>>
1260 submit_to_key_internal(
const serialization::pimpl::data& key_data,
1261 const serialization::pimpl::data& processor)
1263 return submit_to_key_data(key_data, processor);
1266 template<
typename K,
typename EntryProcessor>
1267 boost::future<EntryVector> execute_on_keys_internal(
1268 const std::unordered_set<K>& keys,
1269 const EntryProcessor& entry_processor)
1272 return boost::make_ready_future(EntryVector());
1274 std::vector<serialization::pimpl::data> keysData;
1275 for (
const auto& k : keys) {
1276 keysData.push_back(to_data<K>(k));
1278 return proxy::IMapImpl::execute_on_keys_data(
1279 keysData, to_data<EntryProcessor>(entry_processor));
1282 virtual boost::future<protocol::ClientMessage> put_all_internal(
1284 const EntryVector& entries)
1286 return proxy::IMapImpl::put_all_data(partition_id, entries);
1290 template<
typename K,
typename V>
1291 std::vector<std::pair<K, boost::optional<V>>> sort_and_get(
1292 query::paging_predicate<K, V>& predicate,
1293 query::iteration_type iteration_type,
1294 std::vector<std::pair<K, V>> entries)
1296 std::vector<std::pair<K, boost::optional<V>>> optionalEntries;
1297 optionalEntries.reserve(entries.size());
1298 for (
auto&& pair : entries) {
1299 optionalEntries.emplace_back(pair.first,
1300 boost::make_optional(pair.second));
1302 return sortAndGet(predicate, iteration_type, optionalEntries);
1305 template<
typename K,
typename V>
1306 std::vector<std::pair<K, boost::optional<V>>> sort_and_get(
1307 query::paging_predicate<K, V>& predicate,
1308 query::iteration_type iteration_type,
1309 std::vector<std::pair<K, boost::optional<V>>> entries)
1311 std::sort(entries.begin(),
1313 [&](
const std::pair<K, boost::optional<V>>& lhs,
1314 const std::pair<K, boost::optional<V>>& rhs) {
1315 auto comparator = predicate.getComparator();
1317 switch (predicate.getIterationType()) {
1318 case query::iteration_type::VALUE:
1319 return lhs.second < rhs.second;
1321 return lhs.first < rhs.first;
1325 std::pair<const K*, const V*> leftVal(
1326 &lhs.first, lhs.second.get_ptr());
1327 std::pair<const K*, const V*> rightVal(
1328 &rhs.first, rhs.second.get_ptr());
1329 int result = comparator->compare(&leftVal, &rightVal);
1337 return lhs.first < rhs.first;
1340 std::pair<size_t, size_t> range =
1341 update_anchor<K, V>(entries, predicate, iteration_type);
1343 std::vector<std::pair<K, boost::optional<V>>> result;
1344 for (
size_t i = range.first; i < range.second; ++i) {
1345 auto entry = entries[i];
1346 result.push_back(std::make_pair(entry.first, entry.second));
1354 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1355 #pragma warning(pop)
Map entry listener to get notified when a map entry is added, removed, updated, evicted,...
Concurrent, distributed, observable and queryable map client.
boost::future< std::vector< std::pair< K, V > > > entry_set()
Returns a std::vector< std::pair<K, V> > clone of the mappings contained in this map.
boost::future< boost::optional< V > > put_if_absent(const K &key, const V &value, std::chrono::milliseconds ttl)
Puts an entry into this map with a given ttl (time to live) value if the specified key is not already...
boost::future< void > lock(const K &key, std::chrono::milliseconds lease_time)
Acquires the lock for the specified key for the specified lease time.
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.
boost::future< boost::uuids::uuid > add_entry_listener(entry_listener &&listener, bool include_value)
Adds an entry listener for this map.
boost::future< bool > remove(const K &key, const V &value)
removes entry from map if there is an entry with same key and value.
boost::future< boost::uuids::uuid > add_entry_listener(entry_listener &&listener, bool include_value, const K &key)
Adds the specified entry listener for the specified key.
boost::future< boost::optional< V > > get(const K &key)
get the value.
boost::future< std::vector< std::pair< K, V > > > entry_set(const P &predicate)
Queries the map based on the specified predicate and returns the matching entries.
boost::future< void > remove_all(const P &predicate)
Removes all entries which match with the supplied predicate.
boost::future< boost::optional< R > > replace(const K &key, const V &value)
Replaces the entry for a key only if currently mapped to some value.
boost::future< std::vector< V > > values(const P &predicate)
Returns a vector clone of the values contained in this map.
boost::future< boost::optional< ResultType > > submit_to_key(const K &key, const EntryProcessor &entry_processor)
Applies the user defined EntryProcessor to the entry mapped by the key.
boost::future< boost::optional< R > > put(const K &key, const V &value)
put new entry into map.
boost::future< boost::optional< V > > remove(const K &key)
remove entry form map
boost::future< void > set(const K &key, const V &value)
Puts an entry into this map.
boost::future< std::unordered_map< K, boost::optional< ResultType > > > execute_on_entries(const EntryProcessor &entry_processor, const P &predicate)
Applies the user defined EntryProcessor to the all entries in the map.
boost::future< std::unordered_map< K, V > > get_all(const std::unordered_set< K > &keys)
Returns the entries for the given keys.
boost::future< void > add_index(config::index_config::index_type type, T... attributes)
Convenient method to add an index to this map with the given type and attributes.
boost::future< std::vector< std::pair< K, V > > > entry_set(query::paging_predicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the matching entries.
boost::future< bool > replace(const K &key, const V &old_value, const N &new_value)
Replaces the entry for a key only if currently mapped to a given value.
boost::future< void > force_unlock(const K &key)
Releases the lock for the specified key regardless of the lock owner.
boost::future< boost::uuids::uuid > add_entry_listener(entry_listener &&listener, const P &predicate, bool include_value)
Adds an entry listener for this map.
boost::future< bool > contains_key(const K &key)
check if this map contains key.
boost::future< bool > try_remove(const K &key, std::chrono::milliseconds timeout)
Tries to remove the entry with the given key from this map within specified timeout value.
boost::future< void > lock(const K &key)
Acquires the lock for the specified key.
boost::future< std::string > add_interceptor(const MapInterceptor &interceptor)
Adds an interceptor for this map.
boost::future< std::vector< V > > values()
Returns a vector clone of the values contained in this map.
boost::future< std::vector< K > > key_set(query::paging_predicate< K, V > &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries.
boost::future< boost::optional< ResultType > > execute_on_key(const K &key, const EntryProcessor &entry_processor)
Applies the user defined EntryProcessor to the entry mapped by the key.
monitor::local_map_stats & get_local_map_stats()
Returns LocalMapStats for this map.
boost::future< std::vector< V > > values(query::paging_predicate< K, V > &predicate)
Returns a vector clone of the values contained in this map.
boost::future< void > put_all(const std::unordered_map< K, V > &entries)
Copies all of the mappings from the specified map to this map (optional operation).
boost::future< std::vector< K > > key_set()
Returns a vector clone of the keys contained in this map.
boost::future< std::unordered_map< K, boost::optional< ResultType > > > execute_on_keys(const std::unordered_set< K > &keys, const EntryProcessor &entry_processor)
Applies the user defined EntryProcessor to the entries mapped by the collection of keys.
boost::future< bool > contains_value(const V &value)
check if this map contains value.
boost::future< boost::optional< R > > put(const K &key, const V &value, std::chrono::milliseconds ttl)
Puts an entry into this map with a given ttl (time to live) value.
static const std::chrono::milliseconds UNSET
Default TTL value of a record.
boost::future< bool > is_locked(const K &key)
Checks the lock for the specified key.
boost::future< void > add_index(const config::index_config &config)
Adds an index to this map for the specified entries so that queries can run faster.
boost::future< std::vector< K > > key_set(const P &predicate)
Queries the map based on the specified predicate and returns the keys of matching entries.
boost::future< bool > try_lock(const K &key, std::chrono::milliseconds timeout)
Tries to acquire the lock for the specified key.
boost::future< boost::optional< V > > put_if_absent(const K &key, const V &value)
Puts an entry into this map, if the specified key is not already associated with a value.
boost::future< std::unordered_map< K, boost::optional< ResultType > > > execute_on_entries(const EntryProcessor &entry_processor)
Applies the user defined EntryProcessor to the all entries in the map.
boost::future< void > delete_entry(const K &key)
removes entry from map.
boost::future< bool > try_lock(const K &key)
Tries to acquire the lock for the specified key.
boost::future< bool > evict(const K &key)
Evicts the specified key from this map.
boost::future< bool > try_put(const K &key, const V &value, std::chrono::milliseconds timeout)
Tries to put the given key, value into this map within specified timeout value.
boost::future< boost::optional< entry_view< K, V > > > get_entry_view(const K &key)
Returns the EntryView for the specified key.
boost::future< void > set(const K &key, const V &value, std::chrono::milliseconds ttl)
Puts an entry into this map.
boost::future< void > unlock(const K &key)
Releases the lock for the specified key.
boost::future< void > put_transient(const K &key, const V &value, std::chrono::milliseconds ttl)
Same as put(K, V, int64_t, TimeUnit) but MapStore, if defined, will not be called to store/persist th...
NOTE: paging_predicate can only be used with values(), keySet() and entries() methods!...
Configuration of an index.