WC_Helper_API_Backoff::record │ public static │ WC 11.3.0

Record a backoff window of a fixed length for a request type, e.g. after a failed request.

Method of the class: WC_Helper_API_Backoff{}

No Hooks.

Returns

void. Nothing (null).

Usage

$result = WC_Helper_API_Backoff::record( $request_type, $seconds ): void;
$request_type(string) (required)
The Helper API request type (e.g. 'update-check').
$seconds(int) (required)
Length of the window, in seconds.

Changelog

Since 11.3.0 Introduced.

WC_Helper_API_Backoff::record() code WC 11.3.0

public static function record( string $request_type, int $seconds ): void {
	if ( $seconds <= 0 ) {
		return;
	}

	set_transient( self::get_transient_key( $request_type ), time() + $seconds, $seconds );
}