Verified Commit 5293920c authored by Erick Hitter's avatar Erick Hitter
Browse files

Improve cache-flushing command by moving logic out of the command runner

parent 3387eabb
......@@ -8,3 +8,10 @@ namespace Automattic\WP\Cron_Control;
function is_internal_event( $action ) {
return Internal_Events::instance()->is_internal_event( $action );
}
/**
* Flush plugin's internal caches
*/
function flush_internal_caches() {
return wp_cache_delete( Cron_Options_CPT::CACHE_KEY );
}
......@@ -9,12 +9,10 @@ class Data extends \WP_CLI_Command {
/**
* Flush Cron Control's internal caches
*
* eg.: `wp --allow-root cron-control-data flush-cache`
*
* @subcommand flush-cache
* @subcommand flush-caches
*/
public function flush_internal_cache( $args, $assoc_args ) {
$flushed = wp_cache_delete( \Automattic\WP\Cron_Control\Cron_Options_CPT::CACHE_KEY );
public function flush_internal_caches( $args, $assoc_args ) {
$flushed = \Automattic\WP\Cron_Control\flush_internal_caches();
if ( $flushed ) {
\WP_CLI::success( __( 'Internal caches cleared', 'automattic-cron-control' ) );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment