File tree 2 files changed +38
-5
lines changed 2 files changed +38
-5
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 |
8
- | ` blocking-list-pop.js ` | Block until an element is pushed to a list |
9
- | ` lua-multi-incr.js ` | Define a custom lua script that allows you to perform INCRBY on multiple keys |
5
+ | File Name | Description |
6
+ | -----------------------------| --------------------------------------|
7
+ | ` connect-as-acl-user.js ` | Connect to Redis 6 using an ACL user |
8
+ | ` blocking-list-pop.js ` | Block until an element is pushed to a list |
9
+ | ` lua-multi-incr.js ` | Define a custom lua script that allows you to perform INCRBY on multiple keys |
10
+ | ` command-with-modifiers.js ` | Define a script that allows to run a command with several modifiers |
10
11
11
12
## Contributing
12
13
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
+ await client . del ( 'mykey' ) ;
11
+
12
+ let result = await client . set ( 'mykey' , 'myvalue' , {
13
+ EX : 60 ,
14
+ GET : true
15
+ }
16
+ ) ;
17
+
18
+ console . log ( result ) ; //nil
19
+
20
+ result = await client . set ( 'mykey' , 'newvalue' , {
21
+ EX : 60 ,
22
+ GET : true
23
+ }
24
+ ) ;
25
+
26
+ console . log ( result ) ; //myvalue
27
+
28
+ await client . quit ( ) ;
29
+ }
30
+
31
+ commandWithModifiers ( ) ;
32
+
You can’t perform that action at this time.
0 commit comments