Skip to main content

Valkey

The Valkey Connector facilitates a connection between a terafoundation based project and one or more valkey instances. It uses the Valkey GLIDE client library.

Installation

pnpm add @terascope/valkey

Quick Reference

Terafoundation Configuration

terafoundation:
connectors:
valkey:
default:
addresses:
- host: localhost
port: 6379

Client Configuration

const config: GlideClientConfiguration = {
addresses: [{ host: 'localhost', port: 6379 }]
};

const { client } = await connector.createClient(config, logger);

Key Configuration Parameters

Terafoundation Level:

ParameterDescriptionTypeDefault
addressesDNS addresses and ports of known nodes. Required. In cluster mode the list can be partial; in standalone mode only provided addresses are used.Array<{host: string, port?: number}>null
advancedConfigurationAdvanced client configuration. Supports connectionTimeout (ms), pubsubReconciliationIntervalMs, tcpNoDelay, and tlsAdvancedConfiguration ({insecure?, rootCertificates?}).Objectundefined
clientAzAvailability Zone of the client, used with AZAffinity and AZAffinityReplicasAndPrimary readFrom strategies.Stringundefined
clientNameClient name sent via CLIENT SETNAME during connection establishment.Stringundefined
connectionBackoffReconnection strategy on connection failure. Requires numberOfRetries, factor, and exponentBase (all non-negative integers); optional jitterPercent.Objectundefined
credentialsAuthentication credentials. Password auth: {username?, password}. IAM auth: {username, iamConfig: {clusterName, service, region, refreshIntervalSeconds?}}. service must be "Elasticache" or "MemoryDB".Objectundefined
databaseIdIndex of the logical database to connect to.Integer (≥ 0)undefined (0)
defaultDecoderDefault response decoder when not set per command. One of: "Bytes", "String".Stringundefined ("String")
inflightRequestsLimitMaximum number of concurrent in-flight requests.Integer (> 0)undefined (1000)
lazyConnectWhen true, defers physical connections until the first command is sent.Booleanfalse
protocolSerialization protocol. One of: "RESP2", "RESP3".Stringundefined ("RESP3")
pubsubSubscriptionsPubSub subscriptions applied on connection. channelsAndPatterns is keyed by mode (0=Exact, 1=Pattern) with Sets of channel name strings. Optional callback(msg, context) and arbitrary context.Objectundefined
readFromRead strategy. One of: "primary", "preferReplica", "AZAffinity", "AZAffinityReplicasAndPrimary".Stringundefined ("primary")
readOnlyWhen true, enables read-only mode — write commands are blocked and all connected nodes are treated as valid read targets.Booleanfalse
requestTimeoutDuration in milliseconds the client waits for a request to complete.Integer (> 0)undefined (250)
useTLSWhen true, communication with the server uses Transport Level Security.Booleanfalse