Replies: 3 comments 2 replies
-
Every new better-sqlite3 instance should be considered a running database -- so make sure you manage your instances as singletons appropriately. In case we're talking at ends, for this example: const bs = require("better-sqlite3")
const a = bs("/tmp/test.db")
const b = bs("/tmp/test.db")
|
Beta Was this translation helpful? Give feedback.
-
Here it mentions that multi connections can cause a huge overhead #234 (comment) Maybe a solution like this, could help.
To give some context. I never used better-sqlite3 before, hence why asking. I will migrate a project to sql, right after I finish another part of the project migration. |
Beta Was this translation helpful? Give feedback.
-
That certainly may be applicable for some, but I don't think it's the responsibility of this library to manage singletons or instance lifecycles. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I found your lib this week and wanted to know.
Does your lib always behave as single instance in case I import it multiple times from the same setup?
If not, is there a recommended way to cache it?
Asking this because I tried caching different dbs libs before and it gave weird side effects.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions