SmythOS SDK
    Preparing search index...

    Class CacheInstance

    Base class for all SDK objects.

    This class provides a base implementation for all SDK objects. It handles event emission, promise management, and initialization.

    This object is used to ensure that an SRE instance is initialized, and if not, create one with default settings.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _readyPromise: ControlledPromise<any>

    Accessors

    Methods

    • Check if a key exists in the cache

      Parameters

      • key: string

        The key to check

      Returns Promise<boolean>

      true if the key exists

    • Get a value from the cache

      Parameters

      • key: string

        The key to retrieve

      Returns Promise<any>

      The value associated with the key

    • Get the remaining TTL for a key

      Parameters

      • key: string

        The key to check

      Returns Promise<number>

      The remaining TTL in seconds

    • Set a value in the cache

      Parameters

      • key: string

        The key to set

      • data: any

        The data to store

      • Optionalttl: number

        Optional Time To Live in seconds

      Returns Promise<boolean>

      true if successful

    • Update the TTL for a key

      Parameters

      • key: string

        The key to update

      • Optionalttl: number

        New Time To Live in seconds

      Returns Promise<void>