开发者

Where do I store small data items on a web site?

I am writing a web site using asp.net mvc3 and in my website I want to have a page for setting capacity of a queue. this page is shared between some users. so I need to save this data somewhere which is reachable by all users. I do not like to store this value in Database because it is just a number and I prefer to save in another place.

I also tried storing in file but it is not a good idea too because it need permission setting.

is ther开发者_如何学Pythone any other place than files on server which let me do this?


You are going to have to persist it somewhere if you want it to stay around, either a flat file or database or something similar.

Other than that, you can cache the value in memory (session, static, or another caching scheme) so you aren't constantly reading it from a heavyweight store. For example you could read it in on application start and then just use the in memory variable (writing it back to the disk when it changes).


Just create a table Settings with two columns Key and Value and reuse it for other settings you may need in the future.

Your database is a good place for storing your data - ie. database backups will backup your settings as well.

The alternative is using Configuration Manager.


NoSQL is a great option in this case, I think for this particular case Redis is a better fit, checkout Booksleeve from NuGet

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜