← Back to Docs
  • index.html
  • Clayground
  • Clayground.Storage
  • KeyValueStore
  • Clayground 2025.2
  • KeyValueStore QML Type

    A persistent key-value storage component using SQLite database. More...

    Import Statement: import Clayground.Storage

    Detailed Description

    KeyValueStore provides a simple interface for storing and retrieving key-value pairs that persist across application sessions.

    Properties

    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").

    Methods

    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.