缓存帐户信息 [英] Caching account information

查看:127
本文介绍了缓存帐户信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用的一个ASP.MVC项目我自己的成员实现。我有一个帐户,一个帐户可以有超过1成员。

I currently using my own membership implementation on a ASP.MVC project. I've got an Account and an Account can have more than 1 memberships.

我不知道什么是遵循帐户信息被缓存的最佳方法。我目前加载的帐户信息从控制器的用户属性几乎每个请求。

I am not sure what is the best approach to follow with Account information being cached. I am currently loading the account information for almost each request from the User property of the controller.

我应该缓存的帐户信息?如果在那里将是最好的地方,饼干或会话?

Should I cache the account information? And if where would be the best place, cookies or Session?

推荐答案

我相当强烈反对会议。他们不会很好地扩展,不适合架构的Web / HTTP类型。见这个REST文章,如果你喜欢的东西REST

I recommend fairly strongly against sessions. They won't scale well and do not fit into web/HTTP type of architectures. See 'Key REST principles' in this REST article if you like the REST stuff.

我建议把在Cookie中的用户信息(不超过做到这一点,只是真正需要的东西)。

I would suggest to put the user information in cookies (don't over do it, just really required stuff).

和保持敏感信息在ASP.NET窗体身份验证cookie。请参见窗体身份验证的文章,第4步:附加存储用户数据在门票。

And keep sensitive information in the ASP.NET Forms authentication cookie. See Forms Authentication article, "Step 4: Storing Additional User Data in the Ticket".

从数据库读取数据的其余部分。避免 premature优化

Fetch the rest of the data from the database. Avoid premature optimization.

这篇关于缓存帐户信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆