class WorkerCachedMaintenanceMode implements MaintenanceMode

Properties

static protected null|array{active: bool, data: array} $snapshot

The cached maintenance mode snapshot.

static protected CarbonImmutable|null $refreshedAt

The time when the cached snapshot was last refreshed.

Methods

__construct(MaintenanceMode $driver, int $refreshInterval = 5)

Create a new worker-cached maintenance mode instance.

void
activate(array $payload)

Take the application down for maintenance.

void
deactivate()

Take the application out of maintenance.

bool
active()

Determine if the application is currently down for maintenance.

array
data()

Get the maintenance mode data payload.

static void
flushCache()

Flush the cached maintenance mode state.

array
loadSnapshot()

Load the maintenance mode snapshot from the underlying driver.

bool
shouldRefreshSnapshot()

Determine if the cached snapshot should be refreshed.

Details

at line 30
__construct(MaintenanceMode $driver, int $refreshInterval = 5)

Create a new worker-cached maintenance mode instance.

Parameters

MaintenanceMode $driver
int $refreshInterval

at line 39
void activate(array $payload)

Take the application down for maintenance.

Parameters

array $payload

Return Value

void

at line 49
void deactivate()

Take the application out of maintenance.

Return Value

void

at line 59
bool active()

Determine if the application is currently down for maintenance.

Return Value

bool

at line 67
array data()

Get the maintenance mode data payload.

Return Value

array

at line 75
static void flushCache()

Flush the cached maintenance mode state.

Return Value

void

at line 90
protected array loadSnapshot()

Load the maintenance mode snapshot from the underlying driver.

The active state and payload are read separately from the driver, then retained together so subsequent calls within the refresh interval use the same per-worker snapshot.

Return Value

array

at line 110
protected bool shouldRefreshSnapshot()

Determine if the cached snapshot should be refreshed.

Return Value

bool