wp_cache_mutex_init()WPSCache 1.0

Хуков нет.

Возвращает

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

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

wp_cache_mutex_init();

Код wp_cache_mutex_init() WPSCache 1.12.0

function wp_cache_mutex_init() {
	global $mutex, $wp_cache_mutex_disabled, $use_flock, $blog_cache_dir, $mutex_filename, $sem_id;

	if ( defined( 'WPSC_DISABLE_LOCKING' ) || ( isset( $wp_cache_mutex_disabled ) && $wp_cache_mutex_disabled ) ) {
		return true;
	}

	if ( ! is_bool( $use_flock ) ) {
		if ( function_exists( 'sem_get' ) ) {
			$use_flock = false;
		} else {
			$use_flock = true;
		}
	}

	$mutex = false;
	if ( $use_flock ) {
		setup_blog_cache_dir();
		wp_cache_debug( "Created mutex lock on filename: {$blog_cache_dir}{$mutex_filename}", 5 );
		$mutex = @fopen( $blog_cache_dir . $mutex_filename, 'w' );
	} else {
		wp_cache_debug( "Created mutex lock on semaphore: {$sem_id}", 5 );
		// PHP 8.0 expects a bool. Prior expects an int.
		$auto_release = ( version_compare( phpversion(), '8.0.0', '<=' ) ) ? 1 : true;
		$mutex        = @sem_get( $sem_id, 1, 0666, $auto_release );
	}
}