Running and diagnosing Pulse

Handbook · Coverage · Source reference

Operations means keeping the application, workers, scheduled work and persistent data healthy. A successful web request proves only part of that system. Use this chapter to separate failures before changing anything.

Commands below are local development diagnostics unless explicitly stated otherwise. On a native PHP-FPM host (for example under Plesk) the local Docker container does not exist. This page is not a new production deployment recipe.

First identify the installation

Before using commands, establish the repository, branch, environment and backing services. In the repository root:

git status --short
git branch --show-current
git status

Expected: a visible list of existing changes and clean branch state. Preserve existing changes. main is the primary and sole development branch.

Local backend commands use:

docker compose exec backend php artisan list

Expected: the commands actually registered by this installation. This is the authority for command spelling. Use the documented hub:*/pulse:* commands; plugin:package is a narrow legacy alias, not a general plugin-management namespace.

Installation guard and recovery

The HTTP wizard closes as soon as its first administrator is created. Completed CLI and web installs set INSTALLATION_COMPLETE=true in the environment file and retain storage/installed. Existing user records also close setup if the marker is deleted. /install, /install/ and /install/index.html all pass through the same guard, including on Apache. Local ?preview permits safe reads only; it never authorizes installer POST requests.

A fresh environment example explicitly sets INSTALLATION_COMPLETE=false. If its initial database connection is unavailable, the wizard can display requirements and accept the first database configuration; other installer mutations remain blocked until the connection works. Unknown legacy state or an established installation with an unavailable database fails closed. The completion endpoint only acknowledges an installation after administrator creation; it does not reopen setup or clear running application caches.

Deleting a marker is not a recovery procedure. Repair database/environment settings through the operator's CLI, then inspect state locally:

docker compose exec backend php artisan app:install --check

Exit codes are 0 for installed, 1 for empty, 2 for unavailable and 3 for a populated database needing repair. Once an existing installation reports 0, running php artisan app:install through the same local container restores its marker/latch without reseeding. Investigate code3 and restore verified backups as appropriate; --force is an explicit operator repair choice requiring review of the affected data. Native deployments use their documented PHP CLI and paths instead of Docker.

Health endpoints

URL Access Meaning
/up Framework route, subject to global middleware Laravel health endpoint
/api/v1/healthz/live Public core API route PHP/web request can respond
/api/v1/healthz/ready Public core API route Dependency checks; HTTP 200 ready or 503 unhealthy
/api/v1/admin/system/health Authenticated admin/moderator Separate admin system dashboard
/api/v1/admin/developer/metrics Authenticated admin/moderator Registry introspection

Global IP bans and installation detection can still affect a nominally public probe. Verify the actual status/body rather than configuring a load balancer from the route name alone.

Liveness response

HealthCheckService::checkLive(): array returns status alive, timestamp, app, environment, PHP version, memory usage and uptime_seconds. That uptime is elapsed time since LARAVEL_START for this request, not server or worker lifetime.

For a local installation, replace the base URL with the backend URL from setup:

curl -i http://localhost:8010/api/v1/healthz/live

Expected: HTTP 200 and JSON with status: alive, if routing/installation/IP middleware allow the request. It does not test a login or queue consumer.

Readiness response and side effects

HealthCheckService::checkReady(): array collects database, Redis, storage, Reverb and Horizon status. The readiness boolean requires healthy database, Redis result and storage. Reverb and Horizon can be degraded without making the top-level result unhealthy.

Check Implementation Interpretation
Database PDO connection and SELECT 1 Connectivity, not all migrations/schema correctness
Redis Ping, temporary setex, get and delete Tests read/write when Redis is in use
Storage Temporary write/read/delete via CloudStorageService Requires write permission on selected disk
Reverb TCP connection with 0.6-second timeout Reachability, not end-to-end channel authorization
Horizon Master supervisor repository count Supervisor presence, not every job's completion

Readiness is not strictly read-only: Redis/storage probes create and delete temporary keys/files. Use it knowingly when checking cloud credentials. Redis can be treated as skipped/healthy when unused; a deployed non-Redis setup is not inherently unhealthy.

A readiness response includes connection/database details and errors. Consider that existing exposure when choosing which probe URL to publish through infrastructure.

Metrics registry

App\Core\Services\MetricsRegistry is a static map of callbacks in the current PHP process. It avoids core importing concrete plugin models.

Signature Result/behavior
register(string $key, callable $provider): void Replaces any provider with the same key
get(string $key, mixed $default = 0): mixed Invokes provider, or returns default on absence/exception
all(): array Invokes all providers; failing provider becomes zero
keys(): array Lists keys without invoking callbacks

Example inside an enabled plugin's hooks.php:

use App\Core\Services\MetricsRegistry;

MetricsRegistry::register('welcome.example_count', fn () => 3);

Expected in backend code after this registration: MetricsRegistry::get('welcome.example_count') returns 3. A new request must execute plugin boot/registration again; this is not a historical metrics database. Return inexpensive values because dashboard queries execute callbacks.

Queues and Horizon

config/queue.php defaults to the database connection when QUEUE_CONNECTION is absent. Supported configured connections include sync, database, Beanstalkd, SQS and Redis. Their default retry-after is generally 90 seconds in this file. Each deployment selects its own backend.

The Docker environment example selects QUEUE_CONNECTION=redis, matching its Horizon service. Existing .env files are preserved: if an older Docker install still uses sync or database, deliberately select Redis and restart the backend/workers after checking queued jobs. A database/SQS worker requires its own matching worker process; Horizon does not consume those backends. The SQLite installer uses sync for a dependency-free setup, remembers the preceding queue choice and restores it when switching back to MySQL/PostgreSQL. A queue choice explicitly set by the operator is preserved.

Horizon is configured for Redis queues high, default, ticks, low, with automatic balancing, three tries, 60-second worker timeout and 128 MB worker memory. The local supervisor max is three processes; production max is ten. These configuration values do not start the process manager.

config/horizon.php exposes the configured path horizon by default and web middleware. Inspect actual application authorization before exposing that dashboard. A URL or config file does not prove the operator has configured an authenticated production console.

Local diagnostic commands, after confirming them with artisan list:

docker compose exec backend php artisan queue:failed
docker compose exec backend php artisan horizon:status
docker compose exec backend php artisan schedule:list

Expected: failed-job listing, Horizon state, and registered schedules. These commands do not themselves retry work. A failed-job table being absent is a schema/configuration issue, not proof there are no failures.

The admin POST /api/v1/admin/system/queue/retry-failed endpoint is a mutation. Retrying can repeat payments, notifications or game effects unless the job is designed for idempotency. Diagnose the cause before retrying.

Scheduler and tick pipeline

backend/routes/console.php registers:

Schedule Command Coordination
Every minute pulse:run --interval=minute withoutOverlapping, onOneServer
Hourly pulse:run --interval=hourly Same
Daily pulse:run --interval=daily Same
03:00 daily errors:auto-resolve --days=7 Same
02:40 daily (BACKUP_SCHEDULE_TIME) pulse:backup:database Same, runInBackground; only when backup.schedule.enabled
Every minute ops.scheduler.heartbeat (cache write for ops:health scheduler) none

Local Docker Compose runs php artisan schedule:work in the scheduler service. Horizon, Reverb and the scheduler wait for backend readiness, so they start after first-install migrations finish. Check docker compose ps and docker compose logs scheduler horizon as well as schedule registration; a registered command does not prove execution. There is no sub-minute tick schedule here even though the service supports the tick interval.

Native (Plesk) scheduler and worker setup

On a native PHP-FPM host, nothing runs routes/console.php unless a cron entry does. Without it no tick, no backup and no scheduled clean-up ever runs. Create them in your control panel's scheduled tasks (on Plesk: Websites & Domains → your domain → Scheduled Tasks, "Run a command", as the site's system user) or in that user's crontab. Use the PHP 8.3 CLI that serves the site; plain php on the shell PATH can be a different version (on Plesk confirm with /opt/plesk/php/8.3/bin/php -v). The examples assume the game lives in /var/www/your-game.

Scheduler, every minute, one entry per installation:

* * * * * cd /var/www/your-game/backend && /opt/plesk/php/8.3/bin/php artisan schedule:run >> /dev/null 2>&1

schedule:run must run every minute: the minute tick, withoutOverlapping and onOneServer locks all assume it. These locks need a lock-capable cache store (redis, database or file), not array.

Queue worker. pulse:run only dispatches ProcessPulseTick to the ticks queue; a worker executes it. On shared hosting Supervisor is often unavailable; instead, keep one worker alive with a per-minute cron guarded by flock (the next minute restarts a crashed worker; -n stops duplicates):

# QUEUE_CONNECTION=redis (Horizon):
* * * * * cd /var/www/your-game/backend && flock -n /var/www/your-game/private/horizon.lock /opt/plesk/php/8.3/bin/php artisan horizon >> storage/logs/horizon.log 2>&1
# Any other queue backend (for example QUEUE_CONNECTION=database):
* * * * * cd /var/www/your-game/backend && flock -n /var/www/your-game/private/queue.lock /opt/plesk/php/8.3/bin/php artisan queue:work --queue=ticks,high,default,low --tries=3 --timeout=60 --max-time=3600 >> storage/logs/queue.log 2>&1

Repeat for each extra installation with its own lock files. After each deploy run php artisan horizon:terminate (or php artisan queue:restart) so the worker exits and the cron starts it on the new code within a minute. Confirm flock exists for the subscription user (command -v flock); a chrooted shell may not provide it. Horizon requires Redis; check which queue backend the live .env really uses before choosing a line.

Tick health signal

pulse:run and ProcessPulseTick write durable heartbeats to the pulse_tick_heartbeats table (last dispatch and last completion per interval). Unlike the one-hour cache telemetry, they survive cache:clear/optimize:clear. Read them with:

php artisan ops:health ticks          # exit 0 healthy, 1 stale; one line per interval with a hint
php artisan ops:health ticks --json   # machine-readable
php artisan pulse:status              # includes the same heartbeats

An interval is stale when its last completion is older than OPS_TICK_MINUTE_MAX_AGE (180 s), OPS_TICK_HOURLY_MAX_AGE (4,500 s) or OPS_TICK_DAILY_MAX_AGE (91,800 s). After a fresh deployment hourly/daily report pending until their first boundary. The hint separates "not dispatched" (cron/scheduler) from "dispatched but not completed" (worker, ticks queue, failed jobs). /api/v1/healthz/ready reports the same summary under checks.pulse_ticks and checks.database_backup; they are informational and never turn readiness into 503. Alert on them from an external monitor (JSON/keyword check on checks.pulse_ticks.status == "healthy"), or from cron:

*/5 * * * * cd /var/www/your-game/backend && /opt/plesk/php/8.3/bin/php artisan ops:health ticks > /dev/null || <your alert command>

PulseService::dispatch(string $interval, bool $force = false): bool acquires a cache lock unless forced, records the dispatch timestamp and queues ProcessPulseTick on ticks. False means the interval lock was unavailable. Lock durations are 4 seconds for tick, 55 for minute, 3,500 for hourly and 86,000 for daily.

The dispatch timestamp is not completion evidence. Use telemetry and job state to distinguish “queued” from “ran.” Lock throttling does not guarantee exactly-once business effects across retries; individual tick listeners must make repeated execution safe.

ProcessPulseTick has a 30-second timeout. Its handle(PulseService $pulseService): void calls executePulse($interval, $timestamp).

Tick execution contract

executePulse(string $interval, int $timestamp): array dispatches pulse.{interval} with:

[
    'interval' => 'minute',
    'timestamp' => 1792713600,
    'iso' => 'a timestamp formatted by Carbon',
    'minute' => 0,
    'hour' => 0,
    'day' => 23,
];

The values are derived from the supplied timestamp; the example shape is illustrative, not a fixed clock assertion. The service broadcasts pulse.tick with interval/server_time/timestamp, catches broadcast errors, and stores one-hour telemetry containing last run, duration and listener count.

The return shape is status, interval, duration_ms, results. Hook-level exception isolation can allow completion while a listener failed; inspect hook diagnostics and logs as well as status: success. See hooks.

pulse:run options are --interval=minute, --force, --sync. --sync executes immediately and bypasses the dispatch/lock path; it can change game state. --force bypasses throttling. Do not use either as a harmless health check.

PulseService::getStatus(): array and pulse:status return last dispatches, telemetry and registered hook counts. Admin /admin/pulse/status and /admin/pulse/dispatch expose status/manual dispatch. Dispatch is an administrative mutation.

Logs, exceptions and error management

Laravel file logging and database error records are separate. Bootstrap reports most exceptions into ErrorLog::logError($e, request()) after application boot. Authentication, validation, not-found and method-not-allowed exceptions are excluded by the explicit skip list. A database logging failure is swallowed so it does not replace the original failure.

Frontend error routes are /api/log-frontend-error and versioned /api/v1/log-frontend-error, /log-api-error, /log-vue-error, each rate limited at 30/minute. Their existence does not mean every browser failure was reported successfully.

Admin /api/v1/admin/error-logs provides listing, statistics, record details, resolve/unresolve, bulk changes, old/resolved deletion, and Laravel-file viewing/sync/clear endpoints. Clearing a log destroys evidence; capture the relevant timestamp, stack and request context before cleanup.

The scheduled auto-resolve command marks old errors according to its command implementation. “Resolved” is an administrative state, not proof the original code path has been retested.

Activity records describe user/operator actions; error records describe failures. Neither is an immutable financial ledger. See communication and economy.

LaravelLogReader API

Resolve app(App\Core\Services\LaravelLogReader::class). Its constructor targets storage/logs/laravel.log; it does not automatically discover daily rotated files or every configured logging channel.

Method Result and boundary
parseLogFile(int $limit = 100, ?Carbon $since = null): array Newest parsed entries first; optional timestamp filter. Missing file returns []. Each entry contains Carbon timestamp, environment, level, message, trace, file, line and raw text.
syncToDatabase(int $limit = 50): int Imports recognized file entries into ErrorLog, returns count. Uses recent-record/message/location/time checks to reduce duplicates; not an exactly-once archival guarantee.
getStats(): array File existence/size/modified time plus counts by level across at most 1,000 parsed entries. Missing file omits formatted-size/level fields.
clearLog(): bool Overwrites the selected file with an empty string; true if absent. Does not remove database error records or rotated files.

Parsing expects bracketed dates followed by environment.level: message. Nonmatching entries are skipped; invalid parsed dates fall back to the current time. Although output is limited, the parser reads the whole file into memory before splitting it. An empty result is not proof the log contains no errors, and entry_count is not an all-time total. File read/stat/write failures can throw. Use read-only parsing/statistics for diagnosis; sync and clear are separate authorized mutations. Source.

Database backups and restore

Two separate mechanisms exist. The scheduled database backup (pulse:backup:database) is the disaster-recovery path and is described first. The admin ZIP backups (Admin/BackupController) are a manual convenience.

What the scheduled backup does

php artisan pulse:backup:database [--connection=] (App\Core\Services\Backup\DatabaseBackupService):

  1. Dumps the connection. MySQL/MariaDB (drivers mysql and mariadb): mariadb-dump (or mysqldump) with --single-transaction --quick --skip-lock-tables --no-tablespaces --hex-blob --triggers. This gives a consistent InnoDB snapshot without a global read lock, so players keep playing. Credentials go through a temporary 0600 option file, never the process list. TLS follows the app connection: MYSQL_ATTR_SSL_CA set → ssl-ca, otherwise plain text, like PDO. SQLite: VACUUM INTO plus PRAGMA integrity_check. An in-memory database and other drivers fail explicitly.
  2. Verifies the result. A SQL dump must end with the -- Dump completed trailer, so a truncated dump is rejected. The gzip output is read back in full.
  3. Stores pulse-db-<UTC timestamp>-<random>.sql.gz (or .sqlite.gz) and a sha256sum-format .sha256 file in BACKUP_PATH, with mode 0640. Partial files are removed on failure.
  4. Optionally copies both files to the off-site disk and checks the uploaded size.
  5. Applies retention: keeps the newest BACKUP_RETENTION local dumps and the newest BACKUP_DISK_RETENTION off-site. Only files matching the backup name pattern are ever deleted.
  6. Writes last-run.json (status, last success, redacted error) for ops:health backup.

It exits 1 on any failure, so cron/monitoring sees it. routes/console.php schedules it daily at BACKUP_SCHEDULE_TIME, when BACKUP_SCHEDULE_ENABLED is true. The schedule is on by default only when APP_ENV=production. It needs the scheduler cron above.

Variable Default Meaning
BACKUP_PATH storage/app/backups/database Local dump directory. On Plesk use a path outside the web roots and release directories, e.g. /var/www/your-game/private/backups
BACKUP_RETENTION 14 Local dumps kept
BACKUP_SCHEDULE_ENABLED true in production only Register the daily run
BACKUP_SCHEDULE_TIME 02:40 App timezone; avoids the top of the hour
BACKUP_DISK empty (off) Filesystem disk for the off-site copy, normally backups
BACKUP_DISK_PREFIX / BACKUP_DISK_RETENTION database / 30 Remote folder and dumps kept (0 = leave pruning to bucket lifecycle rules)
BACKUP_S3_ACCESS_KEY_ID, BACKUP_S3_SECRET_ACCESS_KEY, BACKUP_S3_BUCKET, BACKUP_S3_REGION, BACKUP_S3_ENDPOINT, BACKUP_S3_USE_PATH_STYLE_ENDPOINT empty The backups disk in config/filesystems.php: any S3-compatible bucket (R2, S3, B2, MinIO)
BACKUP_DUMP_BINARY / BACKUP_RESTORE_BINARY auto (mariadb-dump→mysqldump, mariadb→mysql) Client paths
BACKUP_DUMP_EXTRA_OPTIONS empty e.g. --routines --events when the DB user has those privileges
BACKUP_TIMEOUT / BACKUP_MAX_AGE_HOURS 3600 / 26 Process timeout; ops:health backup staleness threshold

Off-site copies should go to a private bucket that is separate from asset buckets. Use credentials scoped to that bucket, server-side encryption, and ideally object versioning or lock. Dumps are compressed but not encrypted by the application, and they contain player data and password hashes.

Monitoring a backup

php artisan ops:health backup      # exit 0 healthy; failing / stale / missing / not_offsite otherwise
php artisan pulse:backup:list      # local dumps, last success, last error (read-only)

/api/v1/healthz/ready → checks.database_backup shows only its status (healthy, degraded or not_configured): the route is public. ops:health backup above shows the state and age, and neither shows the error text, which can name database users.

Restore runbook

Restoring replaces the whole target database. Rehearse first, and run every command from the installation's backend directory (for example /var/www/your-game/backend, with the same PHP CLI as the cron entries).

  1. Pick the dump. Run php artisan pulse:backup:list, or download both <name>.sql.gz and <name>.sql.gz.sha256 from the bucket into BACKUP_PATH. A restore refuses a dump without a matching checksum.
  2. Rehearse into a scratch database. Create an empty yourgame_restore_test database in Plesk (Databases) and grant the application's database user access to it. Then run:
    php artisan pulse:backup:restore <name>.sql.gz --database=yourgame_restore_test --force
    
    Check row counts of key tables (users, economy_transactions, player_stats) against expectations. Drop the scratch database afterwards. Rehearse at least quarterly, not only during an incident.
  3. Stop writers. Run php artisan down. Pause the scheduler and worker cron entries, then php artisan horizon:terminate (or queue:restart).
  4. Restore.
    php artisan pulse:backup:restore <name>.sql.gz
    
    This asks for confirmation (--force skips it). It first takes a safety dump of the current database; --skip-safety-backup disables that. Then it verifies the checksum and imports.
  5. Reconcile and resume. The dump drops and recreates each table it contains. Tables created after the dump was taken are left in place. If the dump predates the deployed code, run php artisan migrate --force, then php artisan optimize:clear. Re-enable the cron entries and run php artisan up. Verify with php artisan ops:health ticks and ops:health backup, /api/v1/healthz/ready, and an admin and player login.

The dump does not contain .env/APP_KEY (encrypted columns and sessions depend on it), uploaded files (storage/app/public) or Redis state. Keep .env in the team's secret store. Files need the admin "files" ZIP or the host's own backup; Plesk's subscription backup can complement this but is outside this repository's control. Queued jobs and sessions in Redis are lost on a restore; that is expected.

The restore was verified by DatabaseBackupTest (SQLite round trip, faked MySQL command contract, checksum/confirmation guards, retention, off-site upload/prune) and by MariaDbBackupRoundTripTest (real mariadb-dump + mariadb round trip of Unicode, decimal and binary rows on MariaDB 10.11 and 11.4 in CI). No production restore has been performed.

Admin ZIP backups (manual)

Admin/BackupController writes ZIP archives locally under storage/app/backups and tracks metadata in local JSON. Routes under /api/v1/admin/backups list, create, download, restore and delete backups; settings/storage/test endpoints share that group. Access is the core admin/moderator route boundary.

Create input requires name max 255 and type equal to full, database or files; description is optional. A completed response contains a message and filename.

Feature Current implementation
Database export Same dump as above (mysql/mariadb drivers, option-file credentials, trailer check), stored as database.sql
Database restore mariadb/mysql client import for mysql/mariadb drivers
Files export Public storage plus .env when that file exists
Archive storage Local backup directory only (no schedule, retention or off-site copy)
GET settings Effective environment configuration of the scheduled backup, plus its last result
PUT settings, PUT storage HTTP 422 managed_by: environment; nothing is saved. These endpoints previously reported success without persisting. Credentials are deliberately not accepted through the panel
POST test-storage Writes, reads back and deletes a probe on the local backup directory or the configured BACKUP_DISK (any driver); 422 for an unconfigured driver such as gcs/dropbox

A failed or unsupported database dump fails the request and leaves no archive. Restore overwrites database and files and is not a diagnostic action. Full/files archives can include .env, so downloaded archives contain deployment secrets and must remain private.

Cloud assets are not backup orchestration

CloudStorageService handles asset disks and health checks. R2/S3 support there does not move admin backup ZIPs off the server; only the scheduled database dump is copied off-site, and only to BACKUP_DISK. See configuration for actual disk roots, credentials and URL behavior.

When an asset fails, separate permissions/write failure, URL/CDN failure and missing database reference. storeAsset() returns a path without checking the disk's boolean write result; a returned path alone is insufficient evidence.

Production boundaries and release preparation

Run production on infrastructure you control, with APP_ENV=production, APP_DEBUG=false, HTTPS in front of the game and the database reachable only from the application. The Docker stack in docker-compose.yml binds every port to 127.0.0.1 for this reason: put a reverse proxy with HTTPS in front of it instead of publishing the containers. See going live.

Never reset a live database (migrate:fresh, db:wipe) to fix a problem. On shared hosting, do not install server-wide packages or restart global services. Keep the engine and your game plugins in separate commits so an engine upgrade never overwrites game code. To move an installation from 1.0.0-rc.3 to 1.0.0, follow the 1.0.0 upgrade notes: that upgrade needs the site down while it migrates.

Before a release, verify repository checks, build artifacts, migration compatibility, rollback/recovery material and downstream contracts. Testing explains the required local checks. This handbook does not authorize a deploy or invent an undocumented sequence.

Diagnosis checklist

Symptom Distinguish first
Website works, no timed effects ops:health ticks hint: scheduler cron missing, or worker not consuming ticks? Listener registered?
Pulse dispatch timestamp advances only Worker failure or ticks queue not consumed (ops:health ticks says "Dispatched recently but not completed")
ops:health backup failing pulse:backup:list last error: client binary, credentials, TLS, disk space, off-site credentials
Readiness 503 Specific mandatory dependency in checks, not Reverb warning alone
Live 200, app broken Liveness does not test schema, login or plugins
No notification email Mail queued versus delivered, transport and worker logs
Backup completed, restore unusable ZIP contents, driver branch, dump command result
Cache refresh did not fix UI Registry, actual API response and frontend runtime separately

Source: HealthCheckService, MetricsRegistry, CloudStorageService, PulseService, TickHeartbeat, ProcessPulseTick, PulseCommand, PulseStatusCommand, OperationalHealthCommand, DatabaseBackupService, BackupDatabaseCommand, BackupRestoreCommand, BackupListCommand, BackupController, SystemHealthController, ErrorLogController, bootstrap/app.php, routes/api.php, routes/console.php, config/backup.php, config/operations.php, config/queue.php, config/horizon.php.

This page documents source and read-only command discovery. Backup/restore is verified against disposable SQLite and MariaDB databases only. No live backup/restore, outbound delivery, cloud probe or production deployment is claimed as verified here. The Plesk cron entries above still have to be created by a human with access to the subscription.

CacheService application helpers

Resolve app(App\Core\Services\CacheService::class). Its constants are seconds: short 300, medium 1,800, long 3,600, day 86,400. It uses the configured Laravel cache store, not a separately managed game datastore.

Method Key / result
cacheUser(User $user, int $duration = 300): void Stores the raw model array at user:{id}; this is not the UserResource allowlist.
getUser(int $userId) Cached array or absent-cache result; not a reconstructed User model.
cacheOnlineUsers(int $count, int $duration = 300): void Writes stats:online_users.
getOnlineUsers(): ?int Cached count/null; not a live count calculation.
cacheModules(array $modules, int $duration = 3600): void Writes modules:all; legacy name for plugin data.
getModules(): ?array Cached package array/null.
cacheSettings(array $settings, int $duration = 3600): void Writes settings; separate from SettingService's own cache scheme.
getSettings(): ?array Cached array/null.
clearUserCache(int $userId): void Removes only user:{id}.
clearAll(): void Calls Cache::flush() on the active store; can remove other application state sharing that store.
warmUp(): array Counts users active in the last 15 minutes, caches enabled plugin registry rows; returns success/warmed/message.

Do not expose getUser() directly as a public API response: User's raw serialization includes attributes excluded by the API resource. Cache invalidation and periodic refresh are caller responsibilities. A cached count is not a WebSocket presence membership list. Source.