class PoolRecycler implements Recycler

Properties

protected Timer|null $timer
protected int|null $timerId
protected float $interval

Methods

__construct(Factory $manager, float $interval = 10.0)

Create a pool recycler.

float
getInterval()

Get the maintenance interval in seconds.

void
setInterval(float $interval)

Set the maintenance interval in seconds.

getTimer()

Get the timer used to schedule maintenance.

void
setTimer(Timer $timer)

Set the timer used to schedule maintenance.

int|null
getTimerId()

Get the active maintenance timer ID.

void
start()

Start periodic pool maintenance.

void
stop()

Stop periodic pool maintenance.

void
maintainPools()

Evict idle pools and maintain live pools.

Details

at line 25
__construct(Factory $manager, float $interval = 10.0)

Create a pool recycler.

Parameters

Factory $manager
float $interval

at line 35
float getInterval()

Get the maintenance interval in seconds.

Return Value

float

at line 46
void setInterval(float $interval)

Set the maintenance interval in seconds.

Boot-only. The interval persists on the singleton recycler for the worker lifetime and controls every subsequently scheduled maintenance loop.

Parameters

float $interval

Return Value

void

at line 58
Timer getTimer()

Get the timer used to schedule maintenance.

Return Value

Timer

at line 69
void setTimer(Timer $timer)

Set the timer used to schedule maintenance.

Boot or tests only. Replacing the timer after start would diverge from the already-scheduled loop retained by the previous timer.

Parameters

Timer $timer

Return Value

void

at line 77
int|null getTimerId()

Get the active maintenance timer ID.

Return Value

int|null

at line 88
void start()

Start periodic pool maintenance.

Boot-only. Starting during a request schedules worker-wide maintenance that affects every subsequently registered pool.

Return Value

void

at line 112
void stop()

Stop periodic pool maintenance.

Boot or tests only. Stopping disables automatic maintenance for every pool in the worker.

Return Value

void

at line 124
protected void maintainPools()

Evict idle pools and maintain live pools.

Return Value

void