you are right. I hadn't thought about that.
Did a little test where I only initialize the array on context memory once, and from then on I only
get the array but I don't
set it anymore:
var myArray = context.get("myArray");
console.log("Set the array on context memory");
myArray = context.get("myArray");
msg.payload = myArray;
get returns a reference to the array on the context memory, which means I don't have to
set it after I have changed it.
I understand that it works like this in an in-memory context storage, but not with other kind of storages.
For example when I have an File-base storage, I don't see how it could work unless there is a caching layer that keeps all objects into memory. Or I am just getting nuts
@TizaouiT: I hope you don't mind that we dive a bit deeper... Hopefully your question is already answered in our posts above? If you do it like in @Colin's example (i.e. always
set the array to context after changing), it will work fine...