ServerAPIv1.1.0

資料儲存Storage

歷史資料、玩家統計快取與處罰日誌都寫入資料庫,資料庫是唯一真相來源

storage:
  type: sqlite          # sqlite · mysql · mariadb
主執行緒定期快照,HTTP 請求只讀快取;下半為儲存與多服架構

Redis(選用)

查詢優先讀 Redis,更新時先寫資料庫再覆蓋 Redis。Redis 掛掉會自動降級為資料庫, 服務不中斷,恢復後自動回填。

單機且 Redis 在遠端時,本地資料庫通常反而更快。Redis 的主要價值在跨服彙整。

玩家統計快取

離線玩家的統計需重讀統計檔(實測約 425ms),線上玩家僅約 4ms,因此只對離線玩家快取。 快取存於 Redis/資料庫,不佔用伺服器記憶體

History, the player stat cache and the punishment log all go to a database, which is the single source of truth.

storage:
  type: sqlite          # sqlite · mysql · mariadb
The main thread snapshots on a timer and requests only read the cache

Redis (optional)

Reads prefer Redis; writes go to the database first and then overwrite Redis. If Redis dies the plugin falls back to the database without interruption and backfills on reconnect.

On a single server with a remote Redis, the local database is usually faster. Redis mainly pays off for cross-server aggregation.

Player stat cache

Offline players require re-reading the stats file (~425ms measured) versus ~4ms for online players, so only offline players are cached. Entries live in Redis or the database and use no server memory.

ServerAPI · 僅供非商業用途,商業伺服器需另行取得授權。
ServerAPI · Free for non-commercial use; commercial servers need a separate licence.
Copyright © 2021-2026 CloudXact Studio. All Rights Reserved.