Skip to content

Recommended way to manage open connection #301

Answered by kriszyp
pmbanugo asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, the recommended approach is to use a singleton database instance, and let all db consumers interact with that singleton. lmdb-js is in-process, so it is different the database architecture that involves a network connection, whereas lmdb-js instance doesn't have any type of network connection, it is just an instance with the state of the interface to the database (and there isn't any connection pipe that can get blocked).

Also, when a path isn't specified for open(), and the application exits without calling db.close(), will the temp database still be deleted?

Yes, the temp database will be deleted as long as the process is terminated through normal means. But kill -9, for example,…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pmbanugo
Comment options

Answer selected by pmbanugo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants