node-persist
node-persist copied to clipboard
Question about child processes
This is my assumption, but I wanted to ask anyway: I'm assuming that when you run initSync() that you get a read from disk into memory. And then if you execute getItem, it's from memory, not disk?
In other words, if I have a forked child process and point it to the same directory with node-persist, and call setItem in process A, I probably cannot retrieve that with getItem in process B? Because the data is actually read from the in-process memory?
your assumption is correct. but that sounds like a valid use case. Maybe we can add an option
{ram: false} // defaults to true
this way, everything is read from disk at read-time. Definitely a performance hit, but valid use case
Hmm, instead of always reading from disk, maybe there would be a way to push db updates into memory? Detect a change on disk and refresh?