WorkerCachedMaintenanceMode
class WorkerCachedMaintenanceMode implements MaintenanceMode
Properties
| static protected null|array{active: bool, data: array} | $snapshot | The cached maintenance mode snapshot. |
|
| static protected float|null | $refreshedAt | The time when the cached snapshot was last refreshed. |
Methods
Create a new worker-cached maintenance mode instance.
Take the application down for maintenance.
Take the application out of maintenance.
Determine if the application is currently down for maintenance.
Get the maintenance mode data payload.
Flush the cached maintenance mode state.
Load the maintenance mode snapshot from the underlying driver.
Determine if the cached snapshot should be refreshed.
Get the current time as a Unix timestamp in seconds.
Details
at line 35
__construct(MaintenanceMode $driver, int $refreshInterval = 5)
Create a new worker-cached maintenance mode instance.
at line 44
void
activate(array $payload)
Take the application down for maintenance.
at line 54
void
deactivate()
Take the application out of maintenance.
at line 64
bool
active()
Determine if the application is currently down for maintenance.
at line 72
array
data()
Get the maintenance mode data payload.
at line 80
static void
flushCache()
Flush the cached maintenance mode state.
at line 95
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.
at line 121
protected bool
shouldRefreshSnapshot()
Determine if the cached snapshot should be refreshed.
at line 140
static protected float
now()
Get the current time as a Unix timestamp in seconds.
This runs on every request through the global middleware stack, so the common path uses microtime() rather than Carbon interval arithmetic — building two Carbon instances and an interval to compare them costs microseconds where a float subtraction costs nanoseconds. Carbon is only consulted when a test now is set, so time travel still drives refreshes.