Google App Engine 上的交叉点
当用户 Facebook 连接到我的网站时,我希望将用户的 Facebook 好友列表缩小到已注册我的网站的用户。
所以我有两个列表
- 用户的 facebook 好友的代码列表(大约 1000 个)
- 已注册我的网站的所有 FB 用户的 GAE 表(大约 1000 个)
是执行此操作的最有效方法来执行单个查询所有注册FB用户的UID并在代码中进行交集?
如果有大约 10,000 名 FB 用户注册,而他们无法通过 <<< 中的查询全部检索到,那么最有效的方法是什么? 30秒?
When a user Facebook Connects to my site, I want to narrow down the list of the user's Facebook friends to just those that have already signed up for my website.
So I have two lists
- A list in code of a user's facebook friends (around 1000)
- A GAE table of all FB users that have signed up for my site (around 1000)
Is the most efficient way to do this to do a single query for the UIDs of all signed up FB users and do the intersection in code?
What would be the most efficient way if there were more like 10,000 FB users signed up where they couldn't all be retrieved by queries in < 30 seconds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
把问题稍微扭转一下。当用户登录时,获取他的朋友列表并将 Facebook 数字 ID 存储在用户对象的列表属性中。 (您还可以使用索引对象...查看 Brett 的演讲Slatkin 在 GAE 中进行扇出。)
类似于
当新用户登录时,只需对
friend_ids = :id
进行查询和过滤。这将为您提供一个与您当前用户好友的现有用户列表。我相信这实际上就是你想要的。如果您要查询的 ID 包含在列表中,则根据列表属性过滤的用户查询将返回用户(以防您对此不熟悉)。文档位于此处。
Turn the problem around on it's head slightly. When a user logs in, fetch his friends list and store the facebook numeric ids in an list property on the user's object. (You could also use an index object... look at the talk by Brett Slatkin on doing fan-out in GAE.)
Something like
When a new user logs in, just do a query and filter on
friend_ids = :id
. This should give you a list of existing users who are friends of your current user. Which I believe is actually what you want.The user query filtered on a list property will return a user if the id you're querying for is contained in the list, in case you're not familiar with that. Docs are here.