CLI_Cache_Command::cache_prune()publicWP-CLI 1.0

Prunes the internal cache.

Removes all cached files except for the newest version of each one.

EXAMPLES

$ wp cli cache prune
Success: Cache pruned.

Method of the class: CLI_Cache_Command{}

No Hooks.

Return

null. Nothing.

Usage

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

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

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

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

	$cache->prune();

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