@valkey/valkey-glide-linux-x64-musl 2.5.3-rc1 → 2.6.0-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -68,60 +68,82 @@ npm i @valkey/valkey-glide
68
68
  #### Standalone Mode:
69
69
 
70
70
  ```typescript
71
- import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
72
- // When Valkey is in standalone mode, add address of the primary node, and any replicas you'd like to be able to read from.
71
+ import { GlideClient, Logger } from "@valkey/valkey-glide";
72
+
73
+ Logger.setLoggerConfig("info");
74
+
73
75
  const addresses = [
74
76
  {
75
77
  host: "localhost",
76
78
  port: 6379,
77
79
  },
78
80
  ];
79
- // Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
81
+
82
+ // Check `GlideClientConfiguration` for additional options.
80
83
  const client = await GlideClient.createClient({
81
- addresses: addresses,
82
- // if the server uses TLS, you'll need to enable it. Otherwise, the connection attempt will time out silently.
84
+ addresses,
85
+ // Enable TLS if required by the server.
83
86
  // useTLS: true,
84
- // It is recommended to set a timeout for your specific use case
85
- requestTimeout: 500, // 500ms timeout
87
+ // Set a timeout appropriate for your use case.
88
+ requestTimeout: 500,
86
89
  clientName: "test_standalone_client",
87
90
  });
88
- // The empty array signifies that there are no additional arguments.
89
- const pong = await client.customCommand(["PING"]);
90
- console.log(pong);
91
- const set_response = await client.set("foo", "bar");
92
- console.log(`Set response is = ${set_response}`);
93
- const get_response = await client.get("foo");
94
- console.log(`Get response is = ${get_response}`);
91
+
92
+ try {
93
+ // Pass the command and its arguments as an array.
94
+ const pong = await client.customCommand(["PING"]);
95
+ Logger.log("info", "app", `PING response: ${pong}`);
96
+
97
+ const setResponse = await client.set("foo", "bar");
98
+ Logger.log("info", "app", `Set response is: ${setResponse}`);
99
+
100
+ const getResponse = await client.get("foo");
101
+ Logger.log("info", "app", `Get response is: ${getResponse}`);
102
+ } finally {
103
+ client.close();
104
+ }
95
105
  ```
96
106
 
97
107
  #### Cluster Mode:
98
108
 
99
109
  ```typescript
100
- import { GlideClient, GlideClusterClient, Logger } from "@valkey/valkey-glide";
101
- // When Valkey is in cluster mode, add address of any nodes, and the client will find all nodes in the cluster.
110
+ import { GlideClusterClient, Logger } from "@valkey/valkey-glide";
111
+
112
+ Logger.setLoggerConfig("info");
113
+
114
+ // Add the address of any cluster node; the client discovers the remaining nodes.
102
115
  const addresses = [
103
116
  {
104
117
  host: "localhost",
105
118
  port: 6379,
106
119
  },
107
120
  ];
108
- // Check `GlideClientConfiguration/GlideClusterClientConfiguration` for additional options.
121
+
122
+ // Check `GlideClusterClientConfiguration` for additional options.
109
123
  const client = await GlideClusterClient.createClient({
110
- addresses: addresses,
111
- // if the cluster nodes use TLS, you'll need to enable it. Otherwise the connection attempt will time out silently.
124
+ addresses,
125
+ // Enable TLS if required by the cluster nodes.
112
126
  // useTLS: true,
113
- // It is recommended to set a timeout for your specific use case
114
- requestTimeout: 500, // 500ms timeout
127
+ // Set a timeout appropriate for your use case.
128
+ requestTimeout: 500,
115
129
  clientName: "test_cluster_client",
116
130
  });
117
- // The empty array signifies that there are no additional arguments.
118
- const pong = await client.customCommand(["PING"], { route: "randomNode" });
119
- console.log(pong);
120
- const set_response = await client.set("foo", "bar");
121
- console.log(`Set response is = ${set_response}`);
122
- const get_response = await client.get("foo");
123
- console.log(`Get response is = ${get_response}`);
124
- client.close();
131
+
132
+ try {
133
+ // Pass the command and its arguments as an array.
134
+ const pong = await client.customCommand(["PING"], {
135
+ route: "randomNode",
136
+ });
137
+ Logger.log("info", "app", `PING response: ${pong}`);
138
+
139
+ const setResponse = await client.set("foo", "bar");
140
+ Logger.log("info", "app", `Set response is: ${setResponse}`);
141
+
142
+ const getResponse = await client.get("foo");
143
+ Logger.log("info", "app", `Get response is: ${getResponse}`);
144
+ } finally {
145
+ client.close();
146
+ }
125
147
  ```
126
148
 
127
149
  ### Supported platforms
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@valkey/valkey-glide-linux-x64-musl",
3
3
  "description": "Native bindings for valkey-glide on linux-x64-musl",
4
- "version": "2.5.3-rc1",
4
+ "version": "2.6.0-rc1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/valkey-io/valkey-glide.git"
Binary file