Valkey General Language Independent Driver for the Enterprise (GLIDE) is the official open-source Valkey client library, proudly part of the Valkey organization. Our mission is to make your experience with Valkey and Redis OSS seamless and enjoyable. Whether you're a seasoned developer or just starting out, Valkey GLIDE is here to support you every step of the way.
For full ducumentations, see Valkey GLIDE main documentation site.
Visit Valkey GLIDE Node.js documentations for more examples and further details on TLS, Read strategy, Timeouts and various other topics.
Refer to the Supported Engine Versions table for details.
The release of Valkey GLIDE was tested on the following platforms:
Linux with glibc 2.17 or higher.
MacOS Apple Silicon/aarch_64 and x86_64/amd64.
All alpine versions that are using musl libc 1.2.3 (All Alpine non deprecated alpine versions) or higher should be supported. Tests are running on:
Node.js 16 or higher. For npm users on linux it is recommended to use npm >=11 since it support optional download base on libc, yarn users should not be concerned
Development instructions for local building & testing the package are in the developer instructions section.
npm i @valkey/valkey-glide
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
// When Valkey is in standalone mode, add address of the primary node, and any replicas you'd like to be able to read from.
const addresses = [
{
host: "localhost",
port: 6379,
},
];
// Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
const client = await GlideClient.createClient({
addresses: addresses,
// if the server uses TLS, you'll need to enable it. Otherwise, the connection attempt will time out silently.
// useTLS: true,
// It is recommended to set a timeout for your specific use case
requestTimeout: 500, // 500ms timeout
clientName: "test_standalone_client",
});
// The empty array signifies that there are no additional arguments.
const pong = await client.customCommand(["PING"]);
console.log(pong);
const set_response = await client.set("foo", "bar");
console.log(`Set response is = ${set_response}`);
const get_response = await client.get("foo");
console.log(`Get response is = ${get_response}`);
import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
// When Valkey is in cluster mode, add address of any nodes, and the client will find all nodes in the cluster.
const addresses = [
{
host: "localhost",
port: 6379,
},
];
// Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
const client = await GlideClusterClient.createClient({
addresses: addresses,
// if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
// useTLS: true,
// It is recommended to set a timeout for your specific use case
requestTimeout: 500, // 500ms timeout
clientName: "test_cluster_client",
});
// The empty array signifies that there are no additional arguments.
const pong = await client.customCommand(["PING"], { route: "randomNode" });
console.log(pong);
const set_response = await client.set("foo", "bar");
console.log(`Set response is = ${set_response}`);
const get_response = await client.get("foo");
console.log(`Get response is = ${get_response}`);
client.close();
Currently, the package is tested on:
| Operation systems | C lib | Architecture |
|---|---|---|
Linux |
glibc, musl libc |
x86_64, arm64 |
macOS |
Darwin |
x86_64, arm64 |
We encourage you to join our community to support, share feedback, and ask questions. You can approach us for anything on our Valkey Slack: Join Valkey Slack.