I have a situation where on my nodejs server, I want to call periodically call .once('value', ..) on a very large object tree.
I expect there to be lots of small changes to the tree. I'd like to make sure I'm not fetching the entire tree each time there's a change to it or I want to read it.
If I set up a .on('value', function() { //does nothing }) callback, will that keep the tree cached in memory such that only the changes get sent to my server instead of the whole thing?
Yes. If you have an outstanding event callback registered (even if it does nothing, like in your example), the data will be cached and you'll receive incremental updates as changes occur. So it sounds like that's what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With