@@ -50,18 +50,18 @@ assert.equal(await client.xLen('race:france'), 3);
50
50
51
51
// STEP_START xRange
52
52
const res4 = await client . xRange ( 'race:france' , '1691765278160-0' , '+' , { COUNT : 2 } ) ;
53
- console . log ( res4 ) ; // >>> [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}), ( '1692629594113-0', {' rider' : 'Norem', ' speed' : '28.8', ' position' : '3', ' location_id' : '1'}) ]
53
+ console . log ( res4 ) ; // >>> [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } }, { id: '1692629594113-0', message: { rider: 'Norem', speed: '28.8', position: '3', location_id: '1' } } ]
54
54
// STEP_END
55
55
56
56
// STEP_START xread_block
57
57
const res5 = await client . xRead ( {
58
58
key : 'race:france' ,
59
59
id : '0-0'
60
60
} , {
61
- count : 100 ,
62
- block : 300
61
+ COUNT : 100 ,
62
+ BLOCK : 300
63
63
} ) ;
64
- console . log ( res5 ) ; // >>> [[ 'race:france', [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}), ( '1692629594113-0', {' rider' : 'Norem', ' speed' : '28.8', ' position' : '3', ' location_id' : '1'}), ( '1692629613374-0', {' rider' : 'Prickett', ' speed' : '29.7', ' position' : '2', ' location_id' : '1'})]] ]
64
+ console . log ( res5 ) ; // >>> [{ name: 'race:france', messages: [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } } , { id: '1692629594113-0', message: { rider: 'Norem', speed: '28.8', position: '3', location_id: '1' } }, { id: '1692629613374-0', message: { rider: 'Prickett', speed: '29.7', position: '2', location_id: '1' } }] } ]
65
65
// STEP_END
66
66
67
67
// STEP_START xAdd_2
@@ -101,7 +101,7 @@ try {
101
101
} ) ;
102
102
console . log ( res10 ) ; // >>> 0-1
103
103
} catch ( error ) {
104
- console . error ( error ) ; // >>> WRONGID
104
+ console . error ( error ) ; // >>> [SimpleError: ERR The ID specified in XADD is equal or smaller than the target stream top item]
105
105
}
106
106
// STEP_END
107
107
@@ -112,22 +112,22 @@ console.log(res11a); // >>> 0-3
112
112
113
113
// STEP_START xRange_all
114
114
const res11 = await client . xRange ( 'race:france' , '-' , '+' ) ;
115
- console . log ( res11 ) ; // >>> [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}), ( '1692629594113-0', {' rider' : 'Norem', ' speed' : '28.8', ' position' : '3', ' location_id' : '1'}), ( '1692629613374-0', {' rider' : 'Prickett', ' speed' : '29.7', ' position' : '2', ' location_id' : '1'}), ( '1692629676124-0', {' rider' : 'Castilla', ' speed' : '29.9', ' position' : '1', ' location_id' : '2'}) ]
115
+ console . log ( res11 ) ; // >>> [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } }, { id: '1692629594113-0', message: { rider: 'Norem', speed: '28.8', position: '3', location_id: '1' } }, { id: '1692629613374-0', message: { rider: 'Prickett', speed: '29.7', position: '2', location_id: '1' } }, { id: '1692629676124-0', message: { rider: 'Castilla', speed: '29.9', position: '1', location_id: '2' } } ]
116
116
// STEP_END
117
117
118
118
// STEP_START xRange_time
119
119
const res12 = await client . xRange ( 'race:france' , '1692629576965' , '1692629576967' ) ;
120
- console . log ( res12 ) ; // >>> [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}) ]
120
+ console . log ( res12 ) ; // >>> [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } } ]
121
121
// STEP_END
122
122
123
123
// STEP_START xRange_step_1
124
124
const res13 = await client . xRange ( 'race:france' , '-' , '+' , { COUNT : 2 } ) ;
125
- console . log ( res13 ) ; // >>> [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}), ( '1692629594113-0', {' rider' : 'Norem', ' speed' : '28.8', ' position' : '3', ' location_id' : '1'}) ]
125
+ console . log ( res13 ) ; // >>> [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } }, { id: '1692629594113-0', message: { rider: 'Norem', speed: '28.8', position: '3', location_id: '1' } } ]
126
126
// STEP_END
127
127
128
128
// STEP_START xRange_step_2
129
129
const res14 = await client . xRange ( 'race:france' , '(1692629594113-0' , '+' , { COUNT : 2 } ) ;
130
- console . log ( res14 ) ; // >>> [( '1692629613374-0', {' rider' : 'Prickett', ' speed' : '29.7', ' position' : '2', ' location_id' : '1'}), ( '1692629676124-0', {' rider' : 'Castilla', ' speed' : '29.9', ' position' : '1', ' location_id' : '2'}) ]
130
+ console . log ( res14 ) ; // >>> [{ id: '1692629613374-0', message: { rider: 'Prickett', speed: '29.7', position: '2', location_id: '1' } }, { id: '1692629676124-0', message: { rider: 'Castilla', speed: '29.9', position: '1', location_id: '2' } } ]
131
131
// STEP_END
132
132
133
133
// STEP_START xRange_empty
@@ -139,29 +139,29 @@ console.log(res15); // >>> []
139
139
const res16 = await client . xRevRange ( 'race:france' , '+' , '-' , { COUNT : 1 } ) ;
140
140
console . log (
141
141
res16
142
- ) ; // >>> [( '1692629676124-0', {' rider' : 'Castilla', ' speed' : '29.9', ' position' : '1', ' location_id' : '2'}) ]
142
+ ) ; // >>> [{ id: '1692629676124-0', message: { rider: 'Castilla', speed: '29.9', position: '1', location_id: '2' } } ]
143
143
// STEP_END
144
144
145
145
// STEP_START xread
146
146
const res17 = await client . xRead ( {
147
147
key : 'race:france' ,
148
148
id : '0-0'
149
149
} , {
150
- count : 2
150
+ COUNT : 2
151
151
} ) ;
152
- console . log ( res17 ) ; // >>> [[ 'race:france', [( '1692629576966-0', {' rider' : 'Castilla', ' speed' : '30.2', ' position' : '1', ' location_id' : '1'}), ( '1692629594113-0', {' rider' : 'Norem', ' speed' : '28.8', ' position' : '3', ' location_id' : '1'})]] ]
152
+ console . log ( res17 ) ; // >>> [{ name: 'race:france', messages: [{ id: '1692629576966-0', message: { rider: 'Castilla', speed: '30.2', position: '1', location_id: '1' } } , { id: '1692629594113-0', message: { rider: 'Norem', speed: '28.8', position: '3', location_id: '1' } }] } ]
153
153
// STEP_END
154
154
155
155
// STEP_START xgroup_create
156
156
const res18 = await client . xGroupCreate ( 'race:france' , 'france_riders' , '$' ) ;
157
- console . log ( res18 ) ; // >>> True
157
+ console . log ( res18 ) ; // >>> OK
158
158
// STEP_END
159
159
160
160
// STEP_START xgroup_create_mkstream
161
161
const res19 = await client . xGroupCreate ( 'race:italy' , 'italy_riders' , '$' , {
162
- ' MKSTREAM' : true
162
+ MKSTREAM : true
163
163
} ) ;
164
- console . log ( res19 ) ; // >>> True
164
+ console . log ( res19 ) ; // >>> OK
165
165
// STEP_END
166
166
167
167
// STEP_START xgroup_read
@@ -187,10 +187,10 @@ const res20 = await client.xReadGroup(
187
187
key : 'race:italy' ,
188
188
id : '>'
189
189
} , {
190
- ' COUNT' : 1
190
+ COUNT : 1
191
191
}
192
192
) ;
193
- console . log ( res20 ) ; // >>> [[ 'race:italy', [( '1692629925771-0', {' rider' : 'Castilla'})]] ]
193
+ console . log ( res20 ) ; // >>> [{ name: 'race:italy', messages: [{ id: '1692629925771-0', message: { rider: 'Castilla' } } ] } ]
194
194
// STEP_END
195
195
196
196
// STEP_START xgroup_read_id
@@ -200,10 +200,10 @@ const res21 = await client.xReadGroup(
200
200
key : 'race:italy' ,
201
201
id : '0'
202
202
} , {
203
- ' COUNT' : 1
203
+ COUNT : 1
204
204
}
205
205
) ;
206
- console . log ( res21 ) ; // >>> [[ 'race:italy', [( '1692629925771-0', {' rider' : 'Castilla'})]] ]
206
+ console . log ( res21 ) ; // >>> [{ name: 'race:italy', messages: [{ id: '1692629925771-0', message: { rider: 'Castilla' } } ] } ]
207
207
// STEP_END
208
208
209
209
// STEP_START xack
@@ -216,10 +216,10 @@ const res23 = await client.xReadGroup(
216
216
key : 'race:italy' ,
217
217
id : '0'
218
218
} , {
219
- ' COUNT' : 1
219
+ COUNT : 1
220
220
}
221
221
) ;
222
- console . log ( res23 ) ; // >>> [[ 'race:italy', []] ]
222
+ console . log ( res23 ) ; // >>> [{ name: 'race:italy', messages: [] } ]
223
223
// STEP_END
224
224
225
225
// STEP_START xgroup_read_bob
@@ -229,98 +229,118 @@ const res24 = await client.xReadGroup(
229
229
key : 'race:italy' ,
230
230
id : '>'
231
231
} , {
232
- ' COUNT' : 2
232
+ COUNT : 2
233
233
}
234
234
) ;
235
- console . log ( res24 ) ; // >>> [[ 'race:italy', [( '1692629925789-0', {' rider' : 'Royce'}), ( '1692629925790-0', {' rider' : 'Sam-Bodden'})]] ]
235
+ console . log ( res24 ) ; // >>> [{ name: 'race:italy', messages: [{ id: '1692629925789-0', message: { rider: 'Royce' } } , { id: '1692629925790-0', message: { rider: 'Sam-Bodden' } }] } ]
236
236
// STEP_END
237
237
238
238
// STEP_START xpending
239
239
const res25 = await client . xPending ( 'race:italy' , 'italy_riders' ) ;
240
- console . log ( res25 ) ; // >>> {'pending': 2, 'min ': '1692629925789-0', 'max ': '1692629925790-0', 'consumers': [{'name': 'Bob', 'pending ': 2}]}
240
+ console . log ( res25 ) ; // >>> {'pending': 2, 'firstId ': '1692629925789-0', 'lastId ': '1692629925790-0', 'consumers': [{'name': 'Bob', 'deliveriesCounter ': 2}]}
241
241
// STEP_END
242
242
243
243
// STEP_START xpending_plus_minus
244
244
const res26 = await client . xPendingRange ( 'race:italy' , 'italy_riders' , '-' , '+' , 10 ) ;
245
- console . log ( res26 ) ; // >>> [{'message_id ': '1692629925789-0', 'consumer': 'Bob', 'time_since_delivered ': 31084, 'times_delivered ': 1}, {'message_id ': '1692629925790-0', 'consumer': 'Bob', 'time_since_delivered ': 31084, 'times_delivered ': 1}]
245
+ console . log ( res26 ) ; // >>> [{'id ': '1692629925789-0', 'consumer': 'Bob', 'millisecondsSinceLastDelivery ': 31084, 'deliveriesCounter: ': 1}, {'id ': '1692629925790-0', 'consumer': 'Bob', 'millisecondsSinceLastDelivery ': 31084, 'deliveriesCounter ': 1}]
246
246
// STEP_END
247
247
248
248
// STEP_START xRange_pending
249
249
const res27 = await client . xRange ( 'race:italy' , '1692629925789-0' , '1692629925789-0' ) ;
250
- console . log ( res27 ) ; // >>> [( '1692629925789-0', {' rider' : 'Royce'}) ]
250
+ console . log ( res27 ) ; // >>> [{ id: '1692629925789-0', message: { rider: 'Royce' } } ]
251
251
// STEP_END
252
252
253
253
// STEP_START xclaim
254
254
const res28 = await client . xClaim (
255
255
'race:italy' , 'italy_riders' , 'Alice' , 60000 , [ '1692629925789-0' ]
256
256
) ;
257
- console . log ( res28 ) ; // >>> [( '1692629925789-0', {' rider' : 'Royce'}) ]
257
+ console . log ( res28 ) ; // >>> [{ id: '1692629925789-0', message: { rider: 'Royce' } } ]
258
258
// STEP_END
259
259
260
260
// STEP_START xautoclaim
261
- const res29 = await client . xAutoClaim ( 'race:italy' , 'italy_riders' , 'Alice' , 1 , '0-0' , 1 ) ;
262
- console . log ( res29 ) ; // >>> ['1692629925790-0', [('1692629925789-0', {'rider': 'Royce'})]]
261
+ const res29 = await client . xAutoClaim ( 'race:italy' , 'italy_riders' , 'Alice' , 1 , '0-0' , {
262
+ COUNT : 1
263
+ } ) ;
264
+ console . log ( res29 ) ; // >>> { nextId: '1692629925790-0', messages: [{ id: '1692629925789-0', message: { rider: 'Royce' } }], deletedMessages: [] }
263
265
// STEP_END
264
266
265
267
// STEP_START xautoclaim_cursor
266
268
const res30 = await client . xAutoClaim (
267
- 'race:italy' , 'italy_riders' , 'Alice' , 1 , '(1692629925789-0' , 1
269
+ 'race:italy' , 'italy_riders' , 'Alice' , 1 , '(1692629925789-0' ,
270
+ {
271
+ COUNT : 1
272
+ }
268
273
) ;
269
- console . log ( res30 ) ; // >>> [ '0-0', [( '1692629925790-0', {' rider' : 'Sam-Bodden'})]]
274
+ console . log ( res30 ) ; // >>> { nextId: '0-0', messages: [{ id: '1692629925790-0', message: { rider: 'Sam-Bodden' } } ], deletedMessages: [] }
270
275
// STEP_END
271
276
272
277
// STEP_START xinfo
273
278
const res31 = await client . xInfoStream ( 'race:italy' ) ;
274
- console . log ( res31 ) ; // >>> {' length' : 5, 'radix-tree-keys': 1, 'radix-tree-nodes': 2, 'last-generated-id': '1692629926436-0', 'groups ': 1 , 'first-entry': ( '1692629925771-0', {'rider': 'Castilla'}) , 'last-entry': ( '1692629926436-0', {' rider' : 'Norem'}) }
279
+ console . log ( res31 ) ; // >>> { length: 5, 'radix-tree-keys': 1, 'radix-tree-nodes': 2, 'last-generated-id': '1692629926436-0', 'max-deleted-entry-id ': '0-0' , 'entries-added': 5, 'recorded- first-entry-id ': '1692629925771-0', groups: 1, 'first-entry': { id: '1692629925771-0', message: { rider: 'Castilla' } } , 'last-entry': { id: '1692629926436-0', message: { rider: 'Norem' } } }
275
280
// STEP_END
276
281
277
282
// STEP_START xinfo_groups
278
283
const res32 = await client . xInfoGroups ( 'race:italy' ) ;
279
- console . log ( res32 ) ; // >>> [{' name' : 'italy_riders', ' consumers' : 2, ' pending': 2 , 'last-delivered-id': '1692629925790-0'}]
284
+ console . log ( res32 ) ; // >>> [{ name: 'italy_riders', consumers: 2, pending: 3 , 'last-delivered-id': '1692629925790-0', 'entries-read': 3, lag: 2 }]
280
285
// STEP_END
281
286
282
287
// STEP_START xinfo_consumers
283
288
const res33 = await client . xInfoConsumers ( 'race:italy' , 'italy_riders' ) ;
284
- console . log ( res33 ) ; // >>> [{' name' : 'Alice', ' pending': 2, ' idle': 199332 }, {' name' : 'Bob', ' pending' : 0, ' idle': 489170 }]
289
+ console . log ( res33 ) ; // >>> [{ name: 'Alice', pending: 3, idle: 170582, inactive: 170582 }, { name: 'Bob', pending: 0, idle: 489404, inactive: 489404 }]
285
290
// STEP_END
286
291
287
292
// STEP_START maxlen
288
293
await client . xAdd ( 'race:italy' , '*' , {
289
294
'rider' : 'Jones'
290
295
} , {
291
- 'MAXLEN' : 2
296
+ TRIM : {
297
+ strategy : 'MAXLEN' ,
298
+ strategyModifier : '~' ,
299
+ threshold : 2
300
+ }
292
301
} ) ;
293
302
await client . xAdd ( 'race:italy' , '*' , {
294
303
'rider' : 'Wood'
295
304
} , {
296
- 'MAXLEN' : 2
305
+ TRIM : {
306
+ strategy : 'MAXLEN' ,
307
+ strategyModifier : '~' ,
308
+ threshold : 2
309
+ }
297
310
} ) ;
298
311
await client . xAdd ( 'race:italy' , '*' , {
299
312
'rider' : 'Henshaw'
300
313
} , {
301
- 'MAXLEN' : 2
314
+ TRIM : {
315
+ strategy : 'MAXLEN' ,
316
+ strategyModifier : '~' ,
317
+ threshold : 2
318
+ }
302
319
} ) ;
303
320
304
321
const res34 = await client . xLen ( 'race:italy' ) ;
305
322
console . log ( res34 ) ; // >>> 8
306
323
307
324
const res35 = await client . xRange ( 'race:italy' , '-' , '+' ) ;
308
- console . log ( res35 ) ; // >>> [( '1692629925771-0', {' rider' : 'Castilla'}), ( '1692629925789-0', {' rider' : 'Royce'}), ( '1692629925790-0', {' rider' : 'Sam-Bodden'}), ( '1692629925791-0', {' rider' : 'Prickett'}), ( '1692629926436-0', {' rider' : 'Norem'}), ( '1692630612602-0', {' rider' : 'Jones'}), ( '1692630641947-0', {' rider' : 'Wood'}), ( '1692630648281-0', {' rider' : 'Henshaw'}) ]
325
+ console . log ( res35 ) ; // >>> [{ id: '1692629925771-0', message: { rider: 'Castilla' } }, { id: '1692629925789-0', message: { rider: 'Royce' } }, { id: '1692629925790-0', message: { rider: 'Sam-Bodden' } }, { id: '1692629925791-0', message: { rider: 'Prickett' } }, { id: '1692629926436-0', message: { rider: 'Norem' } }, { id: '1692630612602-0', message: { rider: 'Jones' } }, { id: '1692630641947-0', message: { rider: 'Wood' } }, { id: '1692630648281-0', message: { rider: 'Henshaw' } } ]
309
326
310
327
await client . xAdd ( 'race:italy' , '*' , {
311
328
'rider' : 'Smith'
312
329
} , {
313
- 'MAXLEN' : 2 ,
314
- 'APPROXIMATE' : false
330
+ TRIM : {
331
+ strategy : 'MAXLEN' ,
332
+ strategyModifier : '=' ,
333
+ threshold : 2
334
+ }
315
335
} ) ;
316
336
317
337
const res36 = await client . xRange ( 'race:italy' , '-' , '+' ) ;
318
- console . log ( res36 ) ; // >>> [( '1692630648281-0', {' rider' : 'Henshaw'}), ( '1692631018238-0', {' rider' : 'Smith'}) ]
338
+ console . log ( res36 ) ; // >>> [{ id: '1692630648281-0', message: { rider: 'Henshaw' } }, { id: '1692631018238-0', message: { rider: 'Smith' } } ]
319
339
// STEP_END
320
340
321
341
// STEP_START xTrim
322
342
const res37 = await client . xTrim ( 'race:italy' , 'MAXLEN' , 10 , {
323
- 'APPROXIMATE' : false
343
+ strategyModifier : '=' ,
324
344
} ) ;
325
345
console . log ( res37 ) ; // >>> 0
326
346
// STEP_END
@@ -332,13 +352,13 @@ console.log(res38); // >>> 0
332
352
333
353
// STEP_START xDel
334
354
const res39 = await client . xRange ( 'race:italy' , '-' , '+' ) ;
335
- console . log ( res39 ) ; // >>> [( '1692630648281-0', {' rider' : 'Henshaw'}), ( '1692631018238-0', {' rider' : 'Smith'}) ]
355
+ console . log ( res39 ) ; // >>> [{ id: '1692630648281-0', message: { rider: 'Henshaw' } }, { id: '1692631018238-0', message: { rider: 'Smith' } } ]
336
356
337
357
const res40 = await client . xDel ( 'race:italy' , '1692631018238-0' ) ;
338
358
console . log ( res40 ) ; // >>> 1
339
359
340
360
const res41 = await client . xRange ( 'race:italy' , '-' , '+' ) ;
341
- console . log ( res41 ) ; // >>> [( '1692630648281-0', {' rider' : 'Henshaw'}) ]
361
+ console . log ( res41 ) ; // >>> [{ id: '1692630648281-0', message: { rider: 'Henshaw' } } ]
342
362
// STEP_END
343
363
344
364
// REMOVE_START
0 commit comments