Chok’s Typescript Utilities
    Preparing search index...

    Interface FullStorageAdapter<T>

    Full interface for a storage implementation. Each method can be either sync or async, and the interface works with either implementation scheme.

    Note: We are using interface instead of type ... & because typedoc cannot handle the & syntax to merge types.

    interface FullStorageAdapter<T> {
        clear: () => void | Promise<void>;
        delete: (key: string) => void | Promise<void>;
        gc: () => void | Promise<void>;
        gcNow: () => void | Promise<void>;
        get: (key: string) => T | Promise<T | undefined> | undefined;
        getStoredObject: (
            key: string,
        ) => StoredObject<T> | Promise<StoredObject<T> | undefined> | undefined;
        set: (
            key: string,
            value: T,
            expiryDeltaMs?: number | Duration,
        ) => void | Promise<void>;
        asMap<T>():
            | Map<string, StoredObject<T>>
            | Promise<Map<string, StoredObject<T>>>;
        forEach(
            callback: (
                key: string,
                value: T,
                expiryMs: number,
                storedMs: number,
            ) => void | Promise<void>,
        ): void | Promise<void>;
        size(): number | Promise<number>;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    clear: () => void | Promise<void>
    delete: (key: string) => void | Promise<void>
    gc: () => void | Promise<void>
    gcNow: () => void | Promise<void>
    get: (key: string) => T | Promise<T | undefined> | undefined
    getStoredObject: (
        key: string,
    ) => StoredObject<T> | Promise<StoredObject<T> | undefined> | undefined
    set: (
        key: string,
        value: T,
        expiryDeltaMs?: number | Duration,
    ) => void | Promise<void>

    Methods

    • Parameters

      • callback: (
            key: string,
            value: T,
            expiryMs: number,
            storedMs: number,
        ) => void | Promise<void>

      Returns void | Promise<void>