Set the caching configuration to use for response caching.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The location to store the cache object in. This may vary by cache method.
|
|
|
|
Optional |
Whether or not data should be gzipped before being stored. A value of |
Returns
Type |
Description |
|---|---|
|
A reference to the current instance. |
Examples
Fire a single request, and then cache the response to APC.
Note: This method is inherited by all service-specific classes.
// Instantiate
$sdb = new AmazonSDB();
$sdb->set_cache_config('apc');
// First time pulls live data
$response = $sdb->cache(10)->list_domains();
var_dump($response->isOK());
// Second time pulls from cache
$response = $sdb->cache(10)->list_domains();
var_dump($response->isOK());
Result:
bool(true) bool(true)
Fire a single request, and then cache the response to the file system.
Note: This method is inherited by all service-specific classes.
// Instantiate
$sdb = new AmazonSDB();
$sdb->set_cache_config('./cache');
// First time pulls live data
$response = $sdb->cache(10)->list_domains();
var_dump($response->isOK());
// Second time pulls from cache
$response = $sdb->cache(10)->list_domains();
var_dump($response->isOK());
Result:
bool(true) bool(true)
Source
Method defined in sdk.class.php | Toggle source view (44 lines) | View on GitHub

