@adcp/sdk API Reference - v7.9.0
    Preparing search index...

    Interface RedisLikeClient

    Escape-hatch interface for adopters not using the official redis client (node-redis v4/v5) — e.g., ioredis, Upstash, a test double.

    Mirrors the four methods this backend actually calls. The set signature follows node-redis's options-object form; ioredis users pass a thin shim that maps to its positional API.

    import Redis from 'ioredis';
    const ioredis = new Redis(process.env.REDIS_URL!);

    const client: RedisLikeClient = {
    get: (k) => ioredis.get(k),
    set: (k, v, { EX, NX }) =>
    NX
    ? ioredis.set(k, v, 'EX', EX, 'NX').then(r => (r === 'OK' ? 'OK' : null))
    : ioredis.set(k, v, 'EX', EX),
    del: (k) => ioredis.del(k as string),
    ping: () => ioredis.ping(),
    };
    interface RedisLikeClient {
        get(key: string): Promise<string | null>;
        set(
            key: string,
            value: string,
            options: { EX: number; NX?: boolean },
        ): Promise<string | null>;
        del(key: string | string[]): Promise<number>;
        ping(): Promise<string>;
    }
    Index

    Methods

    Methods

    • Parameters

      • key: string
      • value: string
      • options: { EX: number; NX?: boolean }

      Returns Promise<string | null>