消费社交网络的架构问题休息服务?
我必须集成 Facebook 等社交网络来显示用户朋友已阅读、点击或评论的项目。出现一些架构问题:
问题: a)我应该在我的应用程序数据库中缓存用户的好友列表吗?缺点是用户好友列表可能会发生变化。或者我应该在每次登录后获取此列表?
b) 当用户登录我的应用程序(使用 oauth)时,获取他/她的朋友列表的最佳方式是什么——我应该在 Web 请求线程中执行此操作,这是我在本地数据库中创建位置的地方,或者我应该生成一个不同的任务/线程/批处理作业来获取此列表?
c) 用户缩略图:如果用户登录,我应该缓存用户个人资料缩略图并从我的应用程序中提供它,还是应该在页面上嵌入个人资料图片 URL(指向社交网站)?
I have to integrate Social Networks such as Facebook etc. to display items that have been read or clicked or commented by users' friends. Some architecture questions arise :
questions :
a) should I cache the user's friend list in my app db ? The downside is that the list of users friends could change. Or should I fetch this list after every login ?
b) When a user logs in to my app ( using oauth) , what is the best way to fetch his/her friends list -- should I do that in the web request thread, which is where I am making locs to our local db, or should I spawn a different task / thread/ batch job to fetch this list ?
c) user thumbnail images : if a user logs in , should I cache the user profile thumbnail picture and serve it from my app or should I just embed the profile pic url ( pointing to the social site) on the page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我以前从未与社交网络(SN)集成过,所以我的建议是一般性的(抱歉)。
A) 缓存
B) OAuth
如果您可以异步执行,那么这可能不是一个坏主意。您无法控制目标系统,那么当事情进展不顺利时您该怎么办?您可能希望使其尽可能简单;除了使用 AJAX 之外,我对异步工作了解不多(但这听起来像是您在后端?),所以我不确定具体细节。
C) 缩略图
I've never integrated with Social Networks (SN) before so my advice is going to be general (sorry).
A) Caching
B) OAuth
If you can do it asynchronously then it's probably not a bad idea. You have no control over the target system, so what do you do when things don't go well? You'd probably want to make this as simple as possible; I don't know much about working asynchronously except using AJAX (but this sounds like you're in the back-end?), so I'm not sure of specifics.
C) Thumbnails