final class SessionGarbageCollectionPolicy (View source)

Defines the canonical probability for request-driven session garbage collection.

Constants

DEFAULT_PROBABILITY

Gives the standard 100-entry file/database batches capacity for two candidates per request.

DEFAULT_DIVISOR

Methods

__construct(int $probability = self::DEFAULT_PROBABILITY, int $divisor = self::DEFAULT_DIVISOR)

Defines how many outcomes trigger collection within the positive outcome range.

int

Returns the number of outcomes that trigger collection.

int
int

Returns the total number of possible collection outcomes.

int
bool

Selects whether the current request should perform opportunistic collection.

bool

Details

__construct

__construct(int $probability = self::DEFAULT_PROBABILITY, int $divisor = self::DEFAULT_DIVISOR)

Defines how many outcomes trigger collection within the positive outcome range.

Parameters

int $probability
int $divisor

probability

int probability()

Returns the number of outcomes that trigger collection.

Return Value

int

divisor

int divisor()

Returns the total number of possible collection outcomes.

Return Value

int

shouldRun

bool shouldRun()

Selects whether the current request should perform opportunistic collection.

Return Value

bool