如何在图api中批量请求fql查询? [英] How to do batch request of fql queries in graph api?

查看:216
本文介绍了如何在图api中批量请求fql查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在单个函数中有4-5个fql查询。每个人需要2-4秒才能执行。执行整个功能需要14-15秒。用户需要等待很长时间。所以我想减少处理时间。 (PHP中没有很好的支持多线程概念。)



我已经听说过图api中的批处理请求概念。而且我已经google了很多,但是不了解如何在图形API中使用批量请求进行fql查询。




  • 任何人都可以给出解释使用批量请求的fql查询示例?

  • 什么时候查询处理时间会减少?

  • 有没有其他方法可以减少许多fql查询的时间?


解决方案

而不是单独调用每个FQL查询,为什么不使用FQL Multiquery?



http://developers.facebook.com/docs/参考/ rest / fql.multiquery /



更新
否则,如果不想使用多查询我想你要找的是 here 。我找不到关于FQL和Batch的更多信息。

  curl \ 
-F'access_token = ...' \
-F'batch = [{method:POST,\
relative_url:method / fql.query?query = select + name + from + user + where + uid = 4,\
}]
https://graph.facebook.com


I am having 4-5 fql queries in single function. Each of them taking 2-4 seconds to execute. Total 14-15 seconds are required to execute that whole function. User required to wait for long time. So I want to reduce that processing time. ( There is not well supported multi-threading concept in PHP.)

I have heard of batch request concept in graph api. And I have googled a lot but didn't understand how to use batch request for fql queries in graph api.

  • Can anyone give explanation with example for using batch request of fql queries ?
  • By what time query processing time will reduce?
  • Is there any another method to reduce time of many fql queries?

解决方案

Instead of calling each FQL query separately, why not use FQL Multiquery?

http://developers.facebook.com/docs/reference/rest/fql.multiquery/

UPDATE Otherwise, if you don't want do use multiquery I think what you're looking for is here. I couldn't find anything more about FQL and Batch.

curl \
     -F 'access_token=…' \
     -F 'batch=[{ "method": "POST", \
    "relative_url": "method/fql.query?query=select+name+from+user+where+uid=4", \
     }]
https://graph.facebook.com

这篇关于如何在图api中批量请求fql查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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