Creates a new Cache Parameter Group. Cache Parameter groups control the parameters for a Cache Cluster.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The name of the Cache Parameter Group. |
|
|
|
Required |
The name of the Cache Parameter Group Family the Cache Parameter Group can be used with. Currently, memcached1.4 is the only cache parameter group family supported by the service. |
|
|
|
Required |
The description for the Cache Parameter Group. |
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
|---|---|
|
A |
Examples
End-to-end flow of setting up a new cluster, retrieving data, and shutting it all down.
$elasticache = new AmazonElastiCache();
// Create a new security group
$elasticache->batch()->create_cache_security_group(
'my-security-group',
'This is a memcached security group.'
);
// Create a new parameter group
$elasticache->batch()->create_cache_parameter_group(
'my-param-group',
'memcached1.4',
'This is a memcached parameter group.'
);
// Send requests
$responses = $elasticache->batch()->send(true);
if (!$responses->areOK())
{
die('Either the security or parameter groups failed to be created.');
}
$response = $elasticache->create_cache_cluster(
'my-cluster', # cluster node
2, # number of nodes
'cache.m1.large', # instance type
'memcached', # cache engine
'my-secgroup', # security group
array(
'CacheParameterGroupName' => 'my-paramgroup',
'AutoMinorVersionUpgrade' => 'true'
)
);
if (!$response->isOK())
{
print_r($response);
die('Failed to create new cache cluster.');
}
do {
sleep(20);
$response = $elasticache->describe_cache_clusters(array(
'CacheClusterId' => 'my-cluster'
));
$status = (string) $response->body
->DescribeCacheClustersResult
->CacheClusters
->CacheCluster
->CacheClusterStatus;
}
while ($status !== 'available');
// Display parameter group
echo (string) $response->body
->DescribeCacheClustersResult
->CacheClusters
->CacheCluster
->CacheParameterGroup
->CacheParameterGroupName
. PHP_EOL;
// Display security group
echo (string) $response->body
->DescribeCacheClustersResult
->CacheClusters
->CacheCluster
->CacheSecurityGroups
->CacheSecurityGroup
->CacheSecurityGroupName
. PHP_EOL;
// Clean-up
$response = $elasticache->delete_cache_cluster('my-cluster');
if (!$response->isOK())
{
print_r($response);
die('Cluster deletion was unsuccessful.');
}
else
{
// Wait until the cluster responds with a 404 error
do {
sleep(20);
$response = $elasticache->describe_cache_clusters(array(
'CacheClusterId' => 'my-cluster'
));
}
while ($response->status !== 404);
// Delete the security and parameter groups
$elasticache->batch()->delete_cache_security_group('my-security-group');
$elasticache->batch()->delete_cache_parameter_group('my-param-group');
$responses = $elasticache->batch()->send(true);
if (!$responses->areOK())
{
print_r($responses);
die('Group deletions were unsuccessful.');
}
}
Source
Method defined in services/elasticache.class.php | Toggle source view (9 lines) | View on GitHub

