Johan Nilsson
Johan Nilsson

Reputation: 3

Hazelcast set(k, v) vs EntryProcessor

I have a question regarding EntryProcessor. If I already have a value that I just want to put back in the map.

Would there be any difference in performance using:

map.set(key, value);

Compared to using EntryProcessor:

Value value = new Value();

map.executeOnKey(key, entry -> entry.setValue(value));

FYI I use sync backups.

Upvotes: 0

Views: 145

Answers (1)

Vlado Schreiner
Vlado Schreiner

Reputation: 458

map.set() is a higher level API to update the whole value. It saves the cost of deploying the entry processor class (lambda in the example) to the cluster.

EntryProcessor is better choice if you want to update a small part of larger object (e.g. just a first name for a large customer object).

Upvotes: 0

Related Questions