Interface for local storage providers. Abstracts storage operations to support different storage backends (e.g., browser localStorage, IndexedDB, file system).

Implementations should handle the optional category parameter as follows:

  • IndexedDB: Create separate object stores per category (e.g., mj:RunViewCache)
  • localStorage: Prefix keys with [mj]:[category]:[key]
  • Memory: Use nested Map structure (Map<category, Map<key, value>>)

When category is not provided, use a default category (e.g., 'default' or 'general').

interface ILocalStorageProvider {
    ClearCategory?(category): Promise<void>;
    GetCategoryKeys?(category): Promise<string[]>;
    GetItem(key, category?): Promise<string>;
    Remove(key, category?): Promise<void>;
    SetItem(key, value, category?): Promise<void>;
}

Implemented by

    Methods

    • Clears all items in a specific category. If no category is specified, clears the default category only.

      Parameters

      • category: string

        The category to clear

      Returns Promise<void>

    • Gets all keys in a specific category.

      Parameters

      • category: string

        The category to list keys from

      Returns Promise<string[]>

    • Retrieves an item from storage.

      Parameters

      • key: string

        The key to retrieve

      • Optional category: string

        Optional category for key isolation (e.g., 'RunViewCache', 'Metadata')

      Returns Promise<string>

    • Removes an item from storage.

      Parameters

      • key: string

        The key to remove

      • Optional category: string

        Optional category for key isolation

      Returns Promise<void>

    • Stores an item in storage.

      Parameters

      • key: string

        The key to store under

      • value: string

        The value to store

      • Optional category: string

        Optional category for key isolation

      Returns Promise<void>