Hi Emil,
As you've found out, the cache does not grow indefinitely and will eventually clear. If it doesn't, then that is a bug.
One thing that probably contributed to what you were seeing here (as well as with the transaction issue) was the fact that you were using v0 of our Firebase client, which was released over two years ago. We've made lots of improvements and bug fixes since then! Make sure to upgrade to the latest version of our Node.js client (which can be found at the top of the page
here). We just released 2.2.7 as of this comment. Note that the Firebase client-side JavaScript SDK and Node.js SDK are one and the same.
For what it's worth, we use the Firebase Node.js library to run several of our services, so it is most definitely possible to use it in production. We haven't seen any of the caching issues you reported.
Jacob