delete_cache_parameter_group ( $cache_parameter_group_name, $opt )

Deletes the specified CacheParameterGroup. The CacheParameterGroup cannot be deleted if it is associated with any cache clusters.

Access

public

Parameters

Parameter

Type

Required

Description

$cache_parameter_group_name

string

Required

The name of the Cache Parameter Group to delete.

The specified cache security group must not be associated with any Cache clusters.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

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 (7 lines) | View on GitHub

public function delete_cache_parameter_group($cache_parameter_group_name, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['CacheParameterGroupName'] = $cache_parameter_group_name;
    
    return $this->authenticate('DeleteCacheParameterGroup', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback