Documentation

FlushingBatch extends AbstractBatchDecorator
in package

BatchInterface decorator used to add automatic flushing of the queue when the size of the queue reaches a threshold.

Table of Contents

Properties

$currentTotal  : int
$decoratedBatch  : BatchInterface
$threshold  : int

Methods

__call()  : mixed
Allow decorators to implement custom methods
__construct()  : mixed
add()  : self
Add an item to the queue
flush()  : array<string|int, mixed>
Flush the batch and transfer the items
getDecorators()  : array<string|int, mixed>
Trace the decorators associated with the batch
getThreshold()  : int
Get the auto-flush threshold
isEmpty()  : bool
Check if the batch is empty and has further items to transfer
setThreshold()  : FlushingBatch
Set the auto-flush threshold

Properties

$currentTotal

protected int $currentTotal = 0

Current number of items known to be in the queue

$threshold

protected int $threshold

The threshold for which to automatically flush

Methods

__call()

Allow decorators to implement custom methods

public __call(string $method, array<string|int, mixed> $args) : mixed
Parameters
$method : string

Missing method name

$args : array<string|int, mixed>

Method arguments

Tags
codeCoverageIgnore

__construct()

public __construct(BatchInterface $decoratedBatch, int $threshold) : mixed
Parameters
$decoratedBatch : BatchInterface

BatchInterface that is being decorated

$threshold : int

Flush when the number in queue matches the threshold

add()

Add an item to the queue

public add(mixed $item) : self
Parameters
$item : mixed

Item to add

Return values
self

flush()

Flush the batch and transfer the items

public flush() : array<string|int, mixed>
Return values
array<string|int, mixed>

Returns an array flushed items

getDecorators()

Trace the decorators associated with the batch

public getDecorators() : array<string|int, mixed>
Return values
array<string|int, mixed>

getThreshold()

Get the auto-flush threshold

public getThreshold() : int
Return values
int

isEmpty()

Check if the batch is empty and has further items to transfer

public isEmpty() : bool
Return values
bool

        
On this page

Search results