@@ -21,6 +21,7 @@ import * as L from "@litert/core";
2121
2222 await cli . connect ( ) ;
2323 await cli . auth ( "hello" ) ;
24+
2425 console . log ( await cli . ping ( "" ) ) ;
2526 console . log ( await cli . set ( "a" , "123" ) ) ;
2627 console . log ( await cli . incr ( "a" , 23 ) ) ;
@@ -49,6 +50,53 @@ import * as L from "@litert/core";
4950
5051 await L . Async . sleep ( 2000 ) ;
5152
53+ const pipeline = await cli . pipeline ( ) ;
54+
55+ // Multi Mode
56+ await pipeline . multi ( ) ;
57+ await pipeline . get ( "a" ) ;
58+
59+ await pipeline . set ( "ccc" , "g" ) ;
60+
61+ await pipeline . mGet ( [ "a" , "ccc" ] ) ;
62+
63+ await pipeline . hSet ( "h" , "name" , "Mick" ) ;
64+ await pipeline . hMSet ( "h" , {
65+ "age" : 123 ,
66+ "title" : "Mr."
67+ } ) ;
68+
69+ await pipeline . hMGet ( "h" , [ "age" , "title" ] ) ;
70+ await pipeline . hGetAll ( "h" ) ;
71+ console . log ( JSON . stringify ( await pipeline . scan ( 0 ) , null , 2 ) ) ;
72+
73+ await pipeline . incr ( "a" , 123 ) ;
74+
75+ console . log ( JSON . stringify ( await pipeline . exec ( ) , null , 2 ) ) ;
76+
77+ // Pipeline Mode
78+ await pipeline . get ( "a" ) ;
79+
80+ await pipeline . set ( "ccc" , "g" ) ;
81+
82+ await pipeline . mGet ( [ "a" , "ccc" ] ) ;
83+
84+ await pipeline . hSet ( "h" , "name" , "Mick" ) ;
85+ await pipeline . hMSet ( "h" , {
86+ "age" : 123 ,
87+ "title" : "Mr."
88+ } ) ;
89+
90+ await pipeline . hMGet ( "h" , [ "age" , "title" ] ) ;
91+ await pipeline . hGetAll ( "h" ) ;
92+ console . log ( JSON . stringify ( await pipeline . scan ( 0 ) , null , 2 ) ) ;
93+
94+ await pipeline . incr ( "a" , 123 ) ;
95+
96+ console . log ( JSON . stringify ( await pipeline . exec ( ) , null , 2 ) ) ;
97+
98+ await pipeline . shutdown ( ) ;
99+
52100 await cli . shutdown ( ) ;
53101 await sub . shutdown ( ) ;
54102
0 commit comments