ao-js-sdk - v0.0.9
    Preparing search index...

    Interface ICache<K, V>

    Generic interface for cache implementations. Provides standard cache operations with type-safe key-value pairs.

    interface ICache<K extends {} = string, V extends {} = any> {
        clear(): void;
        delete(key: K): void;
        get(key: K): undefined | V;
        has(key: K): boolean;
        set(key: K, value: V): void;
    }

    Type Parameters

    • K extends {} = string

      The type of keys used in the cache. Defaults to string.

    • V extends {} = any

      The type of values stored in the cache. Defaults to any.

    Index

    Methods

    • Removes an entry from the cache by its key. If the key doesn't exist, this operation has no effect.

      Parameters

      • key: K

        The key to remove from the cache

      Returns void

    • Retrieves a value from the cache by its key.

      Parameters

      • key: K

        The key to look up

      Returns undefined | V

      The cached value if found, undefined otherwise

    • Checks if a key exists in the cache.

      Parameters

      • key: K

        The key to check for

      Returns boolean

      true if the key exists in the cache, false otherwise

    • Stores a value in the cache with the specified key. If the key already exists, its value will be updated.

      Parameters

      • key: K

        The key to store the value under

      • value: V

        The value to cache

      Returns void