Datalayer VS Code Extension - v0.0.9
    Preparing search index...

    Caches Datalayer environments for efficient runtime creation. Singleton pattern ensures single cache instance across extension.

    Index

    Constructors

    Properties

    _cacheTimeout: number = 3600000

    Cache timeout duration in milliseconds (default: 1 hour)

    _environments: EnvironmentDTO[] = []

    Array of cached environment DTOs

    _fetching: boolean = false

    Flag indicating whether a fetch operation is in progress

    _lastFetch: number = 0

    Timestamp of last successful fetch in milliseconds

    _instance: EnvironmentCache

    Singleton instance of EnvironmentCache

    Methods

    • Fetches environments from the API.

      Parameters

      • sdk: DatalayerClient

        Datalayer SDK instance

      Returns Promise<void>

    • Gets cached environments or fetches them if cache is stale.

      Parameters

      • sdk: DatalayerClient

        Datalayer SDK instance

      • authProvider: IAuthProvider

        Authentication provider to check if user is logged in

      • forceRefresh: boolean = false

        Force refresh even if cache is valid

      Returns Promise<EnvironmentDTO[]>

      Array of available environments

    • Gets current cache status.

      Returns {
          cacheValid: boolean;
          environmentCount: number;
          fetching: boolean;
          lastFetch: Date;
      }

      Cache status information

      • cacheValid: boolean

        Whether the cache is currently valid

      • environmentCount: number

        Number of cached environments

      • fetching: boolean

        Whether a fetch operation is in progress

      • lastFetch: Date

        Date of last fetch, or null if never fetched

    • Refreshes environment cache when user logs in. Should be called when authentication state changes to authenticated.

      Parameters

      • sdk: DatalayerClient

        Datalayer SDK instance

      Returns Promise<void>