schedule_wp_gc()WPSCache 1.0

Хуков нет.

Возвращает

null. Ничего (null).

Использование

schedule_wp_gc( $forced );
$forced **
-

Код schedule_wp_gc() WPSCache 1.12.0

function schedule_wp_gc( $forced = 0 ) {
	global $cache_schedule_type, $cache_max_time, $cache_time_interval, $cache_scheduled_time, $cache_schedule_interval;

	if ( false == isset( $cache_time_interval ) ) {
		$cache_time_interval = 3600;
	}

	if ( false == isset( $cache_schedule_type ) ) {
		$cache_schedule_type     = 'interval';
		$cache_schedule_interval = $cache_max_time;
	}
	if ( $cache_schedule_type == 'interval' ) {
		if ( ! isset( $cache_max_time ) ) {
			$cache_max_time = 600;
		}
		if ( $cache_max_time == 0 ) {
			return false;
		}
		$last_gc = get_option( 'wpsupercache_gc_time' );

		if ( ! $last_gc ) {
			update_option( 'wpsupercache_gc_time', time() );
			$last_gc = get_option( 'wpsupercache_gc_time' );
		}
		if ( $forced || ( $last_gc < ( time() - 60 ) ) ) { // Allow up to 60 seconds for the previous job to run
			global $wp_cache_shutdown_gc;
			if ( ! isset( $wp_cache_shutdown_gc ) || $wp_cache_shutdown_gc == 0 ) {
				if ( ! ( $t = wp_next_scheduled( 'wp_cache_gc' ) ) ) {
					wp_clear_scheduled_hook( 'wp_cache_gc' );
					wp_schedule_single_event( time() + $cache_time_interval, 'wp_cache_gc' );
					wp_cache_debug( 'scheduled wp_cache_gc for 10 seconds time.', 5 );
				}
			} else {
				global $time_to_gc_cache;
				$time_to_gc_cache = 1; // tell the "shutdown gc" to run!
			}
		}
	} elseif ( $cache_schedule_type == 'time' && ! wp_next_scheduled( 'wp_cache_gc' ) ) {
		wp_schedule_event( strtotime( $cache_scheduled_time ), $cache_schedule_interval, 'wp_cache_gc' );
	}
	return true;
}