File tree 2 files changed +31
-3
lines changed 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
This folder contains example scripts showing how to use Node Redis in different scenarios.
4
4
5
- | File Name | Description |
6
- | --------------------------| --------------------------------------|
7
- | ` connect-as-acl-user.js ` | Connect to Redis 6 using an ACL user |
5
+ | File Name | Description |
6
+ | -----------------------------| ---------------------------------------------------------------------|
7
+ | ` connect-as-acl-user.js ` | Connect to Redis 6 using an ACL user |
8
+ | ` command-with-modifiers.js ` | Define a script that allows to run a command with several modifiers |
8
9
9
10
## Contributing
10
11
Original file line number Diff line number Diff line change
1
+ // Define a custom script that shows example of SET command
2
+ // with several modifiers.
3
+
4
+ import { createClient } from 'redis' ;
5
+
6
+ async function commandWithModifiers ( ) {
7
+ const client = createClient ( ) ;
8
+
9
+ await client . connect ( ) ;
10
+
11
+ await client . set ( 'mykey' , 'myvalue' , {
12
+ EX : 60 ,
13
+ } ) ;
14
+
15
+ const value = await client . get ( 'mykey' ) ;
16
+
17
+ await client . set ( 'mykey' , 'newvalue' , {
18
+ EX : 60
19
+ } ) ;
20
+
21
+ const value = await client . get ( 'mykey' ) ;
22
+
23
+ await client . quit ( ) ;
24
+ }
25
+
26
+ commandWithModifiers ( ) ;
27
+
You can’t perform that action at this time.
0 commit comments