nocturnal
nocturnal

Reputation: 395

How to get value from IMAP (hazelcast) given the list of keys?

Problem we are trying to solve: Give a list of Keys, what is the best way to get the value from IMap given the number of entries is around 500K?

Also we need to filter the values based on fields.

Here is the example map we are trying to read from.

Given IMap[String, Object] We are using protobuf to serialize the object Object can be say

Message test{ Required mac_address eth_mac = 1, ….// size can be around 300 bytes }

Upvotes: 1

Views: 3643

Answers (1)

sertug
sertug

Reputation: 969

You can use IMap.getAll(keySet) if you know the keys beforehand. It's much better than single gets since it'll be much less network trips in a bulk operation.

For filtering, you can use predicates on IMap.values(predicate), IMap.entryset(predicate) or IMap.keyset(predicate) based on what you want to filter.

See more: http://docs.hazelcast.org/docs/latest/manual/html-single/index.html#distributed-query

Upvotes: 2

Related Questions