存储用户的细节...会话VS缓存! [英] storing user detail ... session vs cache !
问题描述
我想每个用户信息保存在一个地方,那是最好的(meening性能,资源,安全等......为scallable应用程序)女巫是最好的,这样做..会话或高速缓存? (ASP MVC)
i want to save per user information in a place that is the best (meening performance, resources, security etc... for a scallable application) witch is the best for doing so.. session or cache? (ASP MVC)
推荐答案
您可能要检查了这一点:
http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx
You may want to check this out: http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx
缓存将工作,但它不会做对每个用户信息的好工作;它往往是应用全局信息。会议工作,但你可能会遇到并发问题。 <一href=\"http://blog.whiletrue.com/2010/09/asp-net-mvc-sessions-and-concurrent-requests-not-what-youd-expect/\" rel=\"nofollow\">http://blog.whiletrue.com/2010/09/asp-net-mvc-sessions-and-concurrent-requests-not-what-youd-expect/
Caching will work, but it doesn't do a good job on per-user information; it tends to be application-global information. Session works, but you may run into concurrency issues. http://blog.whiletrue.com/2010/09/asp-net-mvc-sessions-and-concurrent-requests-not-what-youd-expect/
我已经有很好的经验(Html.HiddenFor(X => x.MyField))。这使得页面无状态的,你不必担心会话超时;然而,它不是安全的。一个的ViewState上最便宜的一种。 :-)。
I've had good experience with getting information from the database, loading it into a model, and then keeping what I need through the page in hidden variables (Html.HiddenFor(x => x.MyField)). This makes the page stateless and you don't have to worry about session timeout; however, it is not that secure. Kind of a ViewState-on-the-cheap. :-).
这篇关于存储用户的细节...会话VS缓存!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!