Where to store site settings: DB? XML? CONFIG? CLASS FILES?
Posted
by
Emin
on Stack Overflow
See other posts from Stack Overflow
or by Emin
Published on 2012-06-29T07:37:58Z
Indexed on
2012/06/29
9:16 UTC
Read the original article
Hit count: 245
I am re-building a news portal of which already have a large number of visits every day. One of the major concerns when re-building this site was to maximize performance and speed.
Having said this, we have done many things from caching, to all sort of other measures to ensure speed.
Now towards the end of the project, I am having a dilemma of where to store my site settings that would least affect performance.
The site settings will include things such as: Domain, DefaultImgPath, Google Analytics code, default emails of editors as well as more dynamic design/display feature settings such as the background color of specific DIVs and default color for links etc..
As far as I know, I have 4 choices in storing all these info.
Database: Storing general settings in the DB and caching them may be a solution however, I want to limit the access to the database for only necessary and essential functions of the project which generally are insert/update/delete news items, author articles etc..
XML: I can store these settings in an XML file but I have not done this sort of thing before so I don't know what kind of problems -if any- I might face in the future.
CONFIG: I can also store these settings in web.config
CLASS FILE: I can hard code all these settings in a SiteSettings class, but since the site admin himself will be able to edit these settings, It may not be the best solution.
Currently, I am more close to choosing web.config but letting people fiddle with it too often is something I do not want. E.g. if somehow, I miss out a validation for something and it breaks the web.config, the whole site will go down.
My concern basically is that, I cannot forsee any possible consequences of using any of the methods above (or is there any other?), I was hoping to get this question over to more experienced people out here who hopefully help make my decision.
© Stack Overflow or respective owner