简体   繁体   中英

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.

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?

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. 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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM