Specifies that the intended request should be queued for a later batch request.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Optional |
The |
Returns
Type |
Description |
---|---|
A reference to the current instance. |
Examples
Batch several requests together, and then cache the responses to APC.
Note: This method is inherited by all service-specific classes.
// Instantiate $sdb = new AmazonSDB(); $sdb->set_cache_config('apc'); // Prepare for parallel requests $sdb->batch()->list_domains(); $sdb->batch()->list_domains(); // First time pulls live data $response = $sdb->batch()->cache('1 minute')->send(false); var_dump($response[0]->isOK()); var_dump($response[1]->isOK()); // Second time pulls from cache $response = $sdb->batch()->cache('1 minute')->send(false); var_dump($response[0]->isOK()); var_dump($response[1]->isOK());Result:
bool(true) bool(true) bool(true) bool(true)
Batch several requests together, and then cache the responses to the file system.
Note: This method is inherited by all service-specific classes.
// Instantiate $sdb = new AmazonSDB(); $sdb->set_cache_config('./cache'); // Prepare for parallel requests $sdb->batch()->list_domains(); $sdb->batch()->list_domains(); // First time pulls live data $response = $sdb->batch()->cache('1 minute')->send(false); var_dump($response[0]->isOK()); var_dump($response[1]->isOK()); // Second time pulls from cache $response = $sdb->batch()->cache('1 minute')->send(false); var_dump($response[0]->isOK()); var_dump($response[1]->isOK());Result:
bool(true) bool(true) bool(true) bool(true)
Source
Method defined in sdk.class.php | Toggle source view (20 lines) | View on GitHub