interface IRedisClient
Since 0.1.0

Structural shape of an ioredis-compatible client. Used for validation and injection so that the plugin does not hard-depend on ioredis.

Methods

get(key: string): Promise<string | null>

Get a string value by key. Returns null when missing.

set(
key: string,
value: string,
ttlMode?: "EX",
ttlSeconds?: number
): Promise<string | null>

Set a key with optional TTL.

del(...keys: string[]): Promise<number>

Delete one or more keys. Returns the count of removed keys.

exists(key: string): Promise<number>

Check if a key exists. Returns 1 or 0.

Since 0.5.0
ping(): Promise<string>

Pings the server (M90b). The Redis store's reachability probe invokes it; a PONG response proves the backend is reachable, and a rejection does not. The real ioredis client implements it.

scan(
cursor: string,
matcher: string,
matchValue?: string
): Promise<[string, string[]]>

Cursor-based scan. Returns [cursor, keys[]]. Use '0' to start and continue until cursor returns '0'.

quit(): Promise<void>

Gracefully close the connection.

optional
connect(): Promise<void>

Establish the connection.

Usage

import { type IRedisClient } from "cache-plugin/src/index.ts";