I have a struct in C++
struct Person
{
std::string name;
bool male;
int32_t age;
};
and built a IMap<int, Person> and fill it with values.
auto map = hz.get_map("map").get();
auto p1 = Person{"Mike", true, 10};
auto p2 = Person{"Maria", false, 15};
map->put(1, p1).get();
map->put(2, p2).get();
//
p2.age = 18;
//
// Some code here to update Maria's age...
How to update age of Maria without fully rewriting a p2 struct?
This example is too naive but if the Person struct has many fields of different types (POD, vectors, etc) then full overriding/serialization becomes an expensive operation.
Small example of code would be greatly appreciated.
This question is related to similar question which has no answer with a clue.
If it's simple update, something like
might be enough.
For more complex needs and you have Java coding ability, then a server side EntryProcessor Java / EntryProcessor C++ is specifically designed for in-situ updates. It's a function invoked by the C++ client that runs on the Java server.