A persistent key-value storage component using SQLite database. More...
| Import Statement: | import Clayground.Storage |
KeyValueStore provides a simple interface for storing and retrieving key-value pairs that persist across application sessions - in a WebAssembly build across page reloads, too: set() and remove() hand the change to StorageSync, which keeps it in the browser's IndexedDB.
The database name used for storage. Must be set before using the store. Each unique name creates a separate SQLite database file. Use descriptive names to avoid conflicts (e.g., "GameSettings", "PlayerProgress").
Stores a key-value pair in the database. Inserts a new pair or replaces an existing one. Returns true if the operation succeeded.
Retrieves the value for a given key. Returns the stored value, or defVal if the key does not exist.
Checks if a key exists in the database. Returns true if the key exists.
Removes a key-value pair from the database. Returns true after completion.
See also LocalStorage.