Setu-TS
    Preparing search index...

    Class RedisStore

    Redis-backed cache store implementation.

    Values are JSON-serialized before storage so that arbitrary types can be cached. The prefix is applied at construction time and used exclusively by clear() to scope the SCAN+DEL to this instance's keys.

    0.1.0

    Implements

    • CacheStore
    Index
    • Parameters

      • prefix: string

        Key prefix for scoping clear() to this instance's keys. An empty prefix would scan * in clear() — acceptable only for single- tenant Redis deployments.

      • Optionaloptions: {
            client?: IRedisClient;
            commandTimeoutMs?: number;
            connectionErrorReporter?: ConnectionErrorReporter;
            url?: string;
        }

        Redis connection and client options

        • Optionalclient?: IRedisClient

          Injected ioredis-compatible client (bypasses lazy import)

        • OptionalcommandTimeoutMs?: number

          Bound on one Redis command of the client this store BUILDS (default DEFAULT_REDIS_COMMAND_TIMEOUT_MS; 0 disables it). Never applied to an injected client.

        • OptionalconnectionErrorReporter?: ConnectionErrorReporter

          Receives the connection errors (ioredis 'error' events) of the client this store BUILDS, instead of ioredis printing each one to the console. Never attached to an injected client. CachePlugin supplies one backed by its logger.

        • Optionalurl?: string

          Redis connection URL (default redis://localhost:6379)

      Returns RedisStore

      If commandTimeoutMs is not a number from 0 to 2147483647

    • Remove all entries scoped to this backend's prefix.

      The prefix is provided at construction time (not per-call), so each backend can scope the clear appropriately:

      • Redis: SCAN MATCH ${prefix}* + batch DEL
      • Memory: empty the internal map (each plugin instance owns its own map, so it naturally holds only this prefix's keys)

      Returns Promise<void>

    • Delete a value. The key is already-prefixed by CacheService.

      Parameters

      • key: string

        Already-prefixed cache key

      Returns Promise<boolean>

      true if removed

    • Read a value. The key is already-prefixed by CacheService.

      Type Parameters

      • T

        Expected value type

      Parameters

      • key: string

        Already-prefixed cache key

      Returns Promise<T | null>

      The deserialized value, or null when absent/expired

    • Check existence. The key is already-prefixed by CacheService.

      Parameters

      • key: string

        Already-prefixed cache key

      Returns Promise<boolean>

      true if present and unexpired

    • Probes Redis with a typed ping() (M90b). false after disconnect — a store with no client cannot answer — and otherwise true only when the server answers, a rejection being unreachability.

      The plugin caches and bounds this probe; this method is the raw per-call question.

      Returns Promise<boolean>

      true when Redis answers ping

      0.5.0

    • Write a value. The key is already-prefixed by CacheService.

      Type Parameters

      • T

        Value type

      Parameters

      • key: string

        Already-prefixed cache key

      • value: T

        Value to store

      • OptionalttlSeconds: number

        Optional TTL in seconds

      Returns Promise<void>