@@ -173,21 +173,11 @@ $> redis-cli -u <CONNECTION_URI> PING
173
173
- Use the following code snippet to connect to the data store:
174
174
175
175
``` javascript
176
- const Client = require (" ioredis" );
176
+ const Redis = require (" ioredis" );
177
177
178
- // Using connection URI directly.
179
- const client = new Client (" <CONNECTION_URI>" );
180
-
181
- // Using connection options.
182
- const client2 = new Client ({
183
- port: 6385 ,
184
- host: " abcde.dragonflydb.cloud" ,
185
- username: " default" ,
186
- password: " XXXXX" ,
187
- db: 0 ,
188
- });
189
-
190
- client .ping ();
178
+ // Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
179
+ const client = new Redis (" <CONNECTION_URI>" );
180
+ client .ping ().then (resp => console .log (resp));
191
181
```
192
182
193
183
### Python
@@ -198,7 +188,8 @@ client.ping();
198
188
``` python
199
189
import redis
200
190
201
- client = redis.Redis.from_url(' <CONNECTION_URI>' )
191
+ # Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
192
+ client = redis.Redis.from_url(" <CONNECTION_URI>" )
202
193
client.ping()
203
194
```
204
195
@@ -211,22 +202,23 @@ client.ping()
211
202
package main
212
203
213
204
import (
205
+ " context"
214
206
" fmt"
215
207
216
- " github.com/go-redis/redis/v8 "
208
+ " github.com/redis/ go-redis/v9 "
217
209
)
218
210
219
211
func main () {
220
- // Replace " <CONNECTION_URI>" with the actual connection URI.
221
- // Note that <db> is the database number and its default value is 0.
212
+ // Replace <CONNECTION_URI> with the actual Dragonfly Cloud connection URI.
213
+ // Note that <db> is the database number, and its default value is 0.
222
214
opts , err := redis.ParseURL (" <CONNECTION_URI>/<db>" )
223
215
if err != nil {
224
216
panic (err)
225
217
}
226
218
227
219
client := redis.NewClient (opts)
228
220
229
- pong , err := client.Ping (client. Context ()).Result ()
221
+ pong , err := client.Ping (context. Background ()).Result ()
230
222
if err != nil {
231
223
fmt.Println (err)
232
224
}
0 commit comments