I m using (String, Arraylist of String) as the key value pair in gemfire caching.Is there any method to just add or delete a particular value from the value list without getting the entire list and add/delete and publishing the list again?!
-
are you looking to do something like `get(key).add(new value)`? – incomplete-co.de Apr 10 '15 at 04:31
-
Yea! N the whole key gets refreshed at the consumer end! – Shrikkanth Ramesh Apr 13 '15 at 12:15
2 Answers
You can create wrapper object to keep list. This wrapper object can implement delta interface. Using this you can add/delete field from list. See if this helps.

- 12,851
- 32
- 116
- 186

- 31
- 2
-
Thanks hitesh! But will it not refresh entire key at the consumer end if I add/ delete and will only send the updates to the consumer?! – Shrikkanth Ramesh Apr 13 '15 at 12:22
GemFire serializes the value when storing, and has various complex configurations to control the type and level of serialization.
Therefore, when you're updating a value in the value, what's happening is that the serialized value is being streamed to the client and then you're changing it and then re-serializing the changed value and streaming it to the server which is then storing it.
If you want to just update a value in the ArrayList on the server side itself, then you have to create a server-side listener and add that class to the server's classpath so you can manage the serialization/deserialization more finely.
Alternatively, you probably need to change your data model so that the ArrayList value is more like a Map, and is flattened to a secondary region colocated with the primary region, etc.

- 86
- 3