@adcp/client API Reference - v3.3.3
    Preparing search index...

    Interface Storage<T>

    Generic storage interface for caching and persistence

    Users can provide their own implementations (Redis, database, etc.) The library provides a default in-memory implementation

    interface Storage<T> {
        get(key: string): Promise<undefined | T>;
        set(key: string, value: T, ttl?: number): Promise<void>;
        delete(key: string): Promise<void>;
        has(key: string): Promise<boolean>;
        clear?(): Promise<void>;
        keys?(): Promise<string[]>;
        size?(): Promise<number>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implemented by

    Index

    Methods

    • Get a value by key

      Parameters

      • key: string

        Storage key

      Returns Promise<undefined | T>

      Value or undefined if not found

    • Set a value with optional TTL

      Parameters

      • key: string

        Storage key

      • value: T

        Value to store

      • Optionalttl: number

        Time to live in seconds (optional)

      Returns Promise<void>