Optional clientTag to append to library name that is sent to the Redis server
Optional clientClient 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
});
Optional commandDefault 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
}
}
});
Optional commandsMaximum length of the client's internal command queue
Optional credentialsProvides 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.
Optional databaseRedis database number (see SELECT command)
Optional disableIf set to true, disables sending client identifier (user-agent like message) to the redis server
Optional disableWhen true, commands are rejected when the client is reconnecting.
When false, commands are queued for execution after reconnection.
Optional emitWhen set to true, client tracking is turned on and the client emits invalidate events when it receives invalidation messages from the redis server.
Mutually exclusive with clientSideCache option.
Optional functionsOptional maintControls how the client requests the endpoint to reconnect to during a MOVING notification in Redis Enterprise maintenance.
auto: If the connection is opened to a name or IP address that is from/resolves to a reserved private IP range, request an internal endpoint (e.g., internal-ip), otherwise an external one. If TLS is enabled, then request a FQDN.internal-ip: Enforce requesting the internal IP.internal-fqdn: Enforce requesting the internal FQDN.external-ip: Enforce requesting the external IP address.external-fqdn: Enforce requesting the external FQDN.none: Used to request a null endpoint, which tells the client to reconnect based on its current configThe default is auto.
Optional maintControls how the client handles Redis Enterprise maintenance push notifications.
disabled: The feature is not used by the client.enabled: The client attempts to enable the feature on the server. If the server responds with an error, the connection is interrupted.auto: The client attempts to enable the feature on the server. If the server returns an error, the client disables the feature and continues.The default is auto.
Optional maintSpecifies a more relaxed timeout (in milliseconds) for commands during a maintenance window.
This helps minimize command timeouts during maintenance. Timeouts during maintenance period result
in a CommandTimeoutDuringMaintenance error.
The default is 10000
Optional maintSpecifies a more relaxed timeout (in milliseconds) for the socket during a maintenance window.
This helps minimize socket timeouts during maintenance. Timeouts during maintenance period result
in a SocketTimeoutDuringMaintenance error.
The default is 10000
Optional modulesOptional nameClient name (see CLIENT SETNAME)
Optional passwordACL password or the old "--requirepass" password
Optional pingSend PING command at interval (in ms).
Useful with Redis deployments that do not honor TCP Keep-Alive.
Optional readonlyConnect in READONLY mode
Optional scriptsOptional socketSocket connection properties
Optional urlOptional usernameACL username (see ACL guide)
Generated using TypeDoc
Specifies the Redis Serialization Protocol version to use. RESP3 is the default (value 3), while RESP2 (value 2) remains available for compatibility. RESP3 provides additional data types and features introduced in Redis 6.0.