Nestjs Redis Packages - v10
    Preparing search index...

    Interface RedisOptions<M, F, S>

    Interface defining Redis options.

    interface RedisOptions<
        M extends RedisModules = RedisModules,
        F extends RedisFunctions = RedisFunctions,
        S extends RedisScripts = RedisScripts,
    > {
        clientInfoTag?: string;
        clientSideCache?: ClientSideCacheProvider | ClientSideCacheConfig;
        cluster?: RedisClusterOptions<
            RedisModules,
            RedisFunctions,
            RedisScripts,
            RespVersions,
            TypeMapping,
        >;
        commandOptions?: CommandOptions<TypeMapping>;
        commandsQueueMaxLength?: number;
        credentialsProvider?: CredentialsProvider;
        database?: number;
        disableClientInfo?: boolean;
        disableOfflineQueue?: boolean;
        functions?: F;
        modules?: M;
        name?: string;
        password?: string;
        pingInterval?: number;
        readonly?: boolean;
        RESP?: RespVersions;
        scripts?: S;
        socket?: any;
        unstableResp3?: boolean;
        url?: string;
        username?: string;
    }

    Type Parameters

    • M extends RedisModules = RedisModules
    • F extends RedisFunctions = RedisFunctions
    • S extends RedisScripts = RedisScripts

    Hierarchy

    • RedisClientOptions<M, F, S>
      • RedisOptions
    Index

    Properties

    clientInfoTag?: string

    Tag to append to library name that is sent to the Redis server

    clientSideCache?: ClientSideCacheProvider | ClientSideCacheConfig

    Client Side Caching configuration.

    Enables Redis Servers and Clients to work together to cache results from commands sent to a server. The server will notify the client when cached results are no longer valid.

    Note: Client Side Caching is only supported with RESP3.

    const client = createClient({
    RESP: 3,
    clientSideCache: {
    ttl: 0,
    maxEntries: 0,
    evictPolicy: "LRU"
    }
    });
    const cache = new BasicClientSideCache({
    ttl: 0,
    maxEntries: 0,
    evictPolicy: "LRU"
    });
    const client = createClient({
    RESP: 3,
    clientSideCache: cache
    });
    cluster?: RedisClusterOptions<
        RedisModules,
        RedisFunctions,
        RedisScripts,
        RespVersions,
        TypeMapping,
    >

    Redis cluster configuration. Use this when connecting to a Redis Cluster instead of a single Redis instance.

    commandOptions?: CommandOptions<TypeMapping>

    Default command options to be applied to all commands executed through this client.

    These options can be overridden on a per-command basis when calling specific commands.

    const client = createClient({
    commandOptions: {
    asap: true,
    typeMapping: {
    // Custom type mapping configuration
    }
    }
    });
    commandsQueueMaxLength?: number

    Maximum length of the client's internal command queue

    credentialsProvider?: CredentialsProvider

    Provides credentials for authentication. Can be set directly or will be created internally if username/password are provided instead. If both are supplied, this credentialsProvider takes precedence over username/password.

    database?: number

    Redis database number (see SELECT command)

    disableClientInfo?: boolean

    If set to true, disables sending client identifier (user-agent like message) to the redis server

    disableOfflineQueue?: boolean

    When true, commands are rejected when the client is reconnecting. When false, commands are queued for execution after reconnection.

    functions?: F
    modules?: M
    name?: string

    Client name (see CLIENT SETNAME)

    password?: string

    ACL password or the old "--requirepass" password

    pingInterval?: number

    Send PING command at interval (in ms). Useful with Redis deployments that do not honor TCP Keep-Alive.

    readonly?: boolean

    Connect in READONLY mode

    RESP?: RespVersions

    Specifies the Redis Serialization Protocol version to use. RESP2 is the default (value 2), while RESP3 (value 3) provides additional data types and features introduced in Redis 6.0.

    scripts?: S
    socket?: any

    Socket connection properties

    unstableResp3?: boolean

    When set to true, enables commands that have unstable RESP3 implementations. When using RESP3 protocol, commands marked as having unstable RESP3 support will throw an error unless this flag is explicitly set to true. This primarily affects modules like Redis Search where response formats in RESP3 mode may change in future versions.

    url?: string

    Redis connection URL. Format: redis[s]://[[username][:password]@][host][:port][/db-number]

    Examples:

    • redis://localhost:6379
    • redis://user:password@localhost:6379
    • rediss://localhost:6380 (SSL)

    See redis and rediss IANA registration for more details

    username?: string

    ACL username (see ACL guide)