-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Feature - Read data from the RAM (don't always read the file content) #37
Comments
Totally agree. I was very surprised when I looked at the code and saw that all work with the file system is synchronous. I think it would be much better to make a copy of the data in a global variable. And when you change this data, it is invisible, asynchronously, to synchronize it with a local file, if needed. |
Yeah, you are right, @sindresorhus any word? |
I am currently working on a alternative library to save the settings.
I will post here when I publish the process |
@samuelcarreira waiting for this |
@sayem314 I am happy to announce that you can try the beta version of my module https://github.com/samuelcarreira/electron-json-settings-store |
Is it for electron only? I don't use electron. |
Also Sindre Sorhus himself recommends his other module electron-store for electron |
I just want to make everyone aware that this exists and does more or less what is required I am also wondering if this is an issue altogether, since modern operating systems usually have their own RAM cache for frequently used files. This is transparent for tools like node, but my guess is that file accessed multiple times a second will be cached, unless you are running very low on RAM. |
I dug up a little inside the conf module code and appears to me that each get/read function call uses the
fs readFileSync
to get the data from the config file.If I need to constantly check for a value from the app settings it can lead to performance issues. So my approach is to copy the settings to a global variable 👎 and only use this module to write the config file when some changes occur.
Are any alternative approach to this problem or do you plan to add a feature to kinda "cache the values" and only reads the file when there are some changes?
Thank you
The text was updated successfully, but these errors were encountered: