Best way to handle global settings

Hey Guys,

I have a app that I am working that has about 12 settings right now. I also have about 7 different views/states. Some of the settings are being used across every view. Right now I have a settings column using the sqlite cordova plugin. Every view I go to a new view I am doing a query for specific settings. It feels inefficient to be doing this over and over for every view when really the settings should persist. Also as my app gets bigger I know I will be having lots more settings.

What I was thinking of doing is creating a service that contains a settings object that I would load up every time I start the app. That way the information would always avaliable in memory. When I need to update a value I would change that object and then re-save it.

If this seems reasonable I was also wondering the best way to store this object. I could make it a json blob and save it in the sqlite database. I could also just use localstorage to save it and continue using sqlite for the rest of my apps data. I am not sure if saving json would be more efficient or better suited to local storage. I feel very confident that my settings will never hit the 5mb limit for local storage so that should not be an issue.

Let me know if you have any comments or suggestions on the best way to handle global settings for my app.

Thanks in advance,

here is an example of how I handled settings in a project demo for training I did.

I agree, if this was a production solution, I would probably store it is a sqlite db