MediaWiki REL1_39
Wikimedia\WRStats\LimitBatch Class Reference

A class representing a batch of increment/peek operations on a WRStatsRateLimiter. More...

Public Member Functions

 __construct (WRStatsRateLimiter $limiter, $defaultAmount)
 
 globalOp ( $condName, $components=[], $amount=null)
 Construct a global entity key and queue an operation for it.
 
 incr ()
 Execute the batch, unconditionally incrementing all the specified metrics.
 
 localOp ( $condName, $components=[], $amount=null)
 Construct a local entity key and queue an operation for it.
 
 peek ()
 Execute the batch, checking each operation against the defined limit, but don't actually increment the metrics.
 
 tryIncr ()
 Execute the batch, checking each operation against the defined limit.
 

Detailed Description

A class representing a batch of increment/peek operations on a WRStatsRateLimiter.

Since
1.39

Definition at line 10 of file LimitBatch.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\WRStats\LimitBatch::__construct ( WRStatsRateLimiter $limiter,
$defaultAmount )
Access: internal
Parameters
WRStatsRateLimiter$limiter
int$defaultAmount

Definition at line 26 of file LimitBatch.php.

Member Function Documentation

◆ globalOp()

Wikimedia\WRStats\LimitBatch::globalOp ( $condName,
$components = [],
$amount = null )

Construct a global entity key and queue an operation for it.

Parameters
string$condNameThe condition name to be incremented/tested, which must match one of the ones passed to createRateLimiter()
mixed$componentsEntity key components
int | null$amountThe amount, or null to use the default
Returns
$this

Definition at line 64 of file LimitBatch.php.

◆ incr()

Wikimedia\WRStats\LimitBatch::incr ( )

Execute the batch, unconditionally incrementing all the specified metrics.

Definition at line 99 of file LimitBatch.php.

◆ localOp()

Wikimedia\WRStats\LimitBatch::localOp ( $condName,
$components = [],
$amount = null )

Construct a local entity key and queue an operation for it.

Parameters
string$condNameThe condition name to be incremented/tested, which must match one of the ones passed to createRateLimiter()
mixed$componentsEntity key component or array of components
int | null$amountThe amount to increment by, or null to use the default
Returns
$this

Definition at line 43 of file LimitBatch.php.

◆ peek()

Wikimedia\WRStats\LimitBatch::peek ( )

Execute the batch, checking each operation against the defined limit, but don't actually increment the metrics.

Returns
LimitBatchResult

Definition at line 92 of file LimitBatch.php.

◆ tryIncr()

Wikimedia\WRStats\LimitBatch::tryIncr ( )

Execute the batch, checking each operation against the defined limit.

If all operations are allowed, all metrics will be incremented. If some of the operations exceed the limit, none of the metrics will be incremented.

Returns
LimitBatchResult

Definition at line 111 of file LimitBatch.php.


The documentation for this class was generated from the following file: