Storage: IStorage = ...

Storage provides methods to store and retrieve key-value data from the Server Side Storage service.

  • Use Storage.get/set/delete/getValues for scene-scoped storage
  • Use Storage.player.get/set/delete/getValues for player-scoped storage
  • Use Storage.configure to change module-wide defaults (e.g. skipIfUnchanged, cacheReads)

Reads are cached by default: get() serves values known from a network round-trip within the last cacheMaxAgeMs (including confirmed "not found" results) without hitting the service, and concurrent gets for the same key share one request. Overlapping writes to the same key are serialized so the service commits them in issue order, and rapid writes coalesce to the latest value; every set()/delete() resolves once its value (or the newer value that superseded it) is durably applied. By default (skipIfUnchanged) an unchanged set is skipped, but only when a previous confirmed round-trip proved the exact value is already stored. Out-of-band writers (e.g. CLI storage commands) may not be visible for up to cacheMaxAgeMs; use get(key, { fresh: true }) for an authoritative read or Storage.configure({ cacheReads: false }) to disable read caching.

This module only works when running on server-side scenes.