CLI_Cache_Command::cache_prune
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.
Returns
null. Nothing (null).
Usage
$CLI_Cache_Command = new CLI_Cache_Command(); $CLI_Cache_Command->cache_prune();
CLI_Cache_Command::cache_prune() CLI Cache Command::cache prune code WP-CLI 2.13.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.' );
}