CLI_Cache_Command::cache_clear()publicWP-CLI 1.0

Clears the internal cache.

EXAMPLES

$ wp cli cache clear
Success: Cache cleared.

Method of the class: CLI_Cache_Command{}

No Hooks.

Return

null. Nothing.

Usage

$CLI_Cache_Command = new CLI_Cache_Command();
$CLI_Cache_Command->cache_clear();

CLI_Cache_Command::cache_clear() code WP-CLI 2.7.0-alpha

public function cache_clear() {
	$cache = WP_CLI::get_cache();

	if ( ! $cache->is_enabled() ) {
		WP_CLI::error( 'Cache directory does not exist.' );
	}

	$cache->clear();

	WP_CLI::success( 'Cache cleared.' );
}