public function replace( $args, $assoc_args ) {
		list( $key, $value, $group, $expiration ) = $args;
		$result = wp_cache_replace( $key, $value, $group, $expiration );

		if ( false === $result ) {
			WP_CLI::error( "Could not replace object '$key' in group '$group'. Does it not exist?" );
		}

		WP_CLI::success( "Replaced object '$key' in group '$group'." );
	}
public function replace( $args, $assoc_args ) {
		list( $key, $value, $group, $expiration ) = $args;
		$result = wp_cache_replace( $key, $value, $group, $expiration );

		if ( false === $result ) {
			WP_CLI::error( "Could not replace object '$key' in group '$group'. Does it not exist?" );
		}

		WP_CLI::success( "Replaced object '$key' in group '$group'." );
	}
public function replace ( $ args , $ assoc_args ) { list ( $ key , $ value , $ group , $ expiration ) = $ args ; $ result = wp_cache_replace ( $ key , $ value , $ group , $ expiration ) ; if ( false === $ result ) { WP_CLI :: error ( "Could not replace object '$key' in group '$group'. Does it not exist?" ) ; } WP_CLI :: success ( "Replaced object '$key' in group '$group'." ) ; }
Replaces a value in the object cache, if the value already exists.

Errors if the value can't be replaced.

## OPTIONS

<key>
: Cache key.

<value>
: Value to replace.

[<group>]
: Method for grouping data within the cache which allows the same key to be used across groups.
---
default: default
---

[<expiration>]
: Define how long to keep the value, in seconds. `0` means as long as possible.
---
default: 0
---

## EXAMPLES

# Replace cache.
$ wp cache replace my_key new_value my_group
Success: Replaced object 'my_key' in group 'my_group'.
Replaces a value in the object cache if the value already exists .