Automattic\WooCommerce\StoreApi

Authentication::get_rate_limiting_idprotected staticWC 1.0

Generates the request grouping identifier for the rate limiting.

Method of the class: Authentication{}

Hooks from the method

Returns

String.

Usage

$result = Authentication::get_rate_limiting_id( $proxy_support ): string;
$proxy_support(true|false) (required)
Rate Limiting proxy support.

Authentication::get_rate_limiting_id() code WC 9.9.4

protected static function get_rate_limiting_id( bool $proxy_support ): string {

	if ( is_user_logged_in() ) {
		$id = (string) get_current_user_id();
	} else {
		$id = md5( self::get_ip_address( $proxy_support ) );
	}

	/**
	 * Filters the rate limiting identifier.
	 *
	 * @param string $id The rate limiting identifier.
	 *
	 * @since 9.8.0
	 */
	$id = apply_filters( 'woocommerce_store_api_rate_limit_id', $id );

	return sanitize_key( $id );
}