WordPress at Your Fingertips
function is not described

ActionScheduler_DataController::free_memory() public WC 1.0

Reduce memory footprint by clearing the database query and object caches.

{} It's a method of the class: ActionScheduler_DataController{}

No Hooks.

Return

null. Nothing.

Usage

$result = ActionScheduler_DataController::free_memory();

Code of ActionScheduler_DataController::free_memory() WC 6.1.1

public static function free_memory() {
	if ( 0 < self::$sleep_time ) {
		/* translators: %d: amount of time */
		\WP_CLI::warning( sprintf( _n( 'Stopped the insanity for %d second', 'Stopped the insanity for %d seconds', self::$sleep_time, 'woocommerce' ), self::$sleep_time ) );
		sleep( self::$sleep_time );
	}

	\WP_CLI::warning( __( 'Attempting to reduce used memory...', 'woocommerce' ) );

	/**
	 * @var $wpdb            \wpdb
	 * @var $wp_object_cache \WP_Object_Cache
	 */
	global $wpdb, $wp_object_cache;

	$wpdb->queries = array();

	if ( ! is_a( $wp_object_cache, 'WP_Object_Cache' ) ) {
		return;
	}

	$wp_object_cache->group_ops      = array();
	$wp_object_cache->stats          = array();
	$wp_object_cache->memcache_debug = array();
	$wp_object_cache->cache          = array();

	if ( is_callable( array( $wp_object_cache, '__remoteset' ) ) ) {
		call_user_func( array( $wp_object_cache, '__remoteset' ) ); // important
	}
}