Lines Matching refs:future

4 The client offers a mode called "future" or "async" mode. This allows batch 
28 responsibility into your code. To enable future mode, set the `future` flag in
39 'future' => 'lazy'
43 $future = $client->get($params);
46 This returns a _future_, rather than the actual response. A future represents a
47 _future computation_ and acts like a placeholder. You can pass a future around
49 _resolve_ the future. If the future has already resolved (due to some other
50 activity), the values are immediately available. If the future has not resolved
55 `future: lazy` and they pend until you resolve the futures, at which time all
60 interface, which makes the future act like a simple associative array. For
71 'future' => 'lazy'
75 $future = $client->get($params);
77 $doc = $future['_source']; // This call blocks and forces the future to resolve
80 Interacting with the future as an associative array, just like a normal
81 response, causes the future to resolve that particular value (which in turn
94 'future' => 'lazy'
102 foreach ($futures as $future) {
103 // access future's values, causing resolution if necessary
104 echo $future['_source'];
111 If you wish to force future resolution, but don't need the values immediately,
112 you can call `wait()` on the future to force resolution, too:
124 'future' => 'lazy'
131 //wait() forces future resolution and will execute the underlying curl batch
158 batch. Note, however, that forcing a future to resolve causes the underlying
160 example, only 499 requests are added to the queue, but the final future
182 'future' => 'lazy'
189 // resolve the future, and therefore the underlying batch
190 $body = $future[499]['body'];
209 'future' => 'lazy'
222 'future' => 'lazy'
238 'future' => 'lazy'
247 // Should return immediately, since the previous future resolved the entire batch
255 There are a few caveats to using future mode. The biggest is also the most
256 obvious: you need to deal with resolving the future yourself. This is usually
266 and fully resolves the future to provide values.
273 When operated in future mode, the unwrapping of the future is left to your