2

I'm working on a PHP (Zend Framework) web application that, for each user request, makes multiple calls to external APIs (SOAP and/or REST over HTTP).

At the moment, the API calls are sequential:

  • Call API A, wait around 1 second for results
  • Call API B, wait around 1 second for results
  • Send page back to the user

In this instance there is no dependency or relation between APIs A and B; I simply want to return the page with all the information as quickly as possible.

At the moment I'm thinking of either:

curl_multi_exec() would bind my client code for APIs A and B more tightly than I'd like.

ZeroMQ seems more complex to implement, and I'm not sure how I'd manage the worker processes and sockets.

Has anyone successfully implemented this behaviour in a PHP/Apache application without too much fuss?

4

1 回答 1

1

听起来你需要一个缓存。它们很容易制作,可以是文件系统或任何数据库扩展。

于 2011-10-08T16:51:35.943 回答