I have a need to store some meta-data in a node.js application I am writing. Rather than come up with my own file format and managing that file, I would like to use an in-process persistant key-value store.
I was looking at mongodb but it seems that mongodb must always be run out-of-process (that is, you need to start a mongo server first, then connect to it in node.js.) I require that whatever store this is, that it exist entirely within the node.js process – or at least that any external processes are entirely managed transparently by the library, and kills them when the application closes the connection.
I don’t care much about performance, but it would be nice to support asynchronous IO to the store to keep up with Node’s whole async thing.
It would also be nice if the store supported indexes, as I will definitely be querying the data in a way where indexes would be helpful.
I’m pretty sure that ‘sqlite’ would work for me, except that I don’t really see it as being nearly as convenient as a key-value store. Ideally I should be able to speak in JSON, not SQL. But sqlite will work if nothing better exists.
Thanks!
You might be interested in using redis http://redis.io/
There is a popular helper library for node https://github.com/mranney/node_redis
Then you can do this: