WooCommerce Code Reference

WC_Rate_Limiter
in package

Rate limit class.

Table of Contents

retried_too_soon()  : bool
Returns true if the action is not allowed to be run by the rate limiter yet, false otherwise.
set_rate_limit()  : bool
Sets the rate limit delay in seconds for action with identifier $id.
storage_id()  : string
Constructs Option name from action identifier.

Methods

retried_too_soon()

Returns true if the action is not allowed to be run by the rate limiter yet, false otherwise.

public static retried_too_soon(string $action_id) : bool
Parameters
$action_id : string

Identifier of the action.

Return values
bool

set_rate_limit()

Sets the rate limit delay in seconds for action with identifier $id.

public static set_rate_limit(string $action_id, int $delay) : bool
Parameters
$action_id : string

Identifier of the action.

$delay : int

Delay in seconds.

Return values
boolTrue if the option setting was successful, false otherwise.

storage_id()

Constructs Option name from action identifier.

public static storage_id(string $action_id) : string
Parameters
$action_id : string

Identifier of the action.

Return values
string