[英]How to update a user's friends from facebook on my site?
I have an app in Rails and I have it configured so that when a user logs into my app, a list of their facebook friends who have authorized my app is stored in my database so that I can display this info to the user. 我在Rails中有一个应用程序,我已对其进行配置,以便当用户登录我的应用程序时,已经授权我的应用程序的Facebook好友列表存储在我的数据库中,以便我可以向用户显示此信息。
But does anyone have any best practices for keeping this information up to date? 但有没有人有任何最佳做法来保持这些信息是最新的? For example, if user A and user B both use my app, and user A adds user B as a friend, how can I ensure that user B is displayed on user A's friend list?
例如,如果用户A和用户B都使用我的应用程序,并且用户A将用户B添加为朋友,我如何确保用户B显示在用户A的朋友列表中?
I know that I could query facebook every time that I display a user's friends list but the main reason for storing a user's facebook friends in the database is to increase performance and prevent having to make this kind of call each time a user clicks through. 我知道每次显示用户的朋友列表时我都可以查询facebook,但是将数据库中的用户的Facebook朋友存储的主要原因是为了提高性能并防止每次用户点击时都要进行此类调用。 Any ideas or best practices?
任何想法或最佳做法?
maybe have a scheduled task to update that information maybe every day or week? 可能有一个计划任务,可能每天或每周更新该信息?
Here is one gem for helping on that https://github.com/bvandenbos/resque-scheduler/ 这是帮助https://github.com/bvandenbos/resque-scheduler/的一个宝石
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.