@@ -267,6 +267,19 @@ extension RedisClient {
267
267
return send ( command: " LPUSH " , with: args)
268
268
. convertFromRESPValue ( )
269
269
}
270
+
271
+ /// Pushes all of the provided elements into a list.
272
+ /// - Note: This inserts the elements at the head of the list; for the tail see `rpush(_:into:)`.
273
+ ///
274
+ /// See [https://redis.io/commands/lpush](https://redis.io/commands/lpush)
275
+ /// - Parameters:
276
+ /// - elements: The values to push into the list.
277
+ /// - key: The key of the list.
278
+ /// - Returns: The length of the list after adding the new elements.
279
+ @inlinable
280
+ public func lpush< Value: RESPValueConvertible > ( _ elements: Value ... , into key: String ) -> EventLoopFuture < Int > {
281
+ return self . lpush ( elements, into: key)
282
+ }
270
283
271
284
/// Pushes an element into a list, but only if the key exists and holds a list.
272
285
/// - Note: This inserts the element at the head of the list, for the tail see `rpushx(_:into:)`.
@@ -318,6 +331,18 @@ extension RedisClient {
318
331
return send ( command: " RPUSH " , with: args)
319
332
. convertFromRESPValue ( )
320
333
}
334
+
335
+ /// Pushes all of the provided elements into a list.
336
+ /// - Note: This inserts the elements at the tail of the list; for the head see `lpush(_:into:)`.
337
+ ///
338
+ /// See [https://redis.io/commands/rpush](https://redis.io/commands/rpush)
339
+ /// - elements: The values to push into the list.
340
+ /// - key: The key of the list.
341
+ /// - Returns: The length of the list after adding the new elements.
342
+ @inlinable
343
+ public func rpush< Value: RESPValueConvertible > ( _ elements: Value ... , into key: String ) -> EventLoopFuture < Int > {
344
+ return self . rpush ( elements, into: key)
345
+ }
321
346
322
347
/// Pushes an element into a list, but only if the key exists and holds a list.
323
348
/// - Note: This inserts the element at the tail of the list; for the head see `lpushx(_:into:)`.
@@ -378,12 +403,31 @@ extension RedisClient {
378
403
///
379
404
/// Otherwise, the key of the list the element was removed from and the popped element.
380
405
@inlinable
381
- public func blpop(
382
- from keys: [ String ] ,
383
- timeout: Int = 0
384
- ) -> EventLoopFuture < ( String , RESPValue ) ? > {
406
+ public func blpop( from keys: [ String ] , timeout: Int = 0 ) -> EventLoopFuture < ( String , RESPValue ) ? > {
385
407
return _bpop ( command: " BLPOP " , keys, timeout)
386
408
}
409
+
410
+ /// Removes the first element of a list, blocking until an element is available.
411
+ ///
412
+ /// - Important:
413
+ /// This will block the connection from completing further commands until an element
414
+ /// is available to pop from the group of lists.
415
+ ///
416
+ /// It is **highly** recommended to set a reasonable `timeout`
417
+ /// or to use the non-blocking `lpop` method where possible.
418
+ ///
419
+ /// See [https://redis.io/commands/blpop](https://redis.io/commands/blpop)
420
+ /// - Parameters:
421
+ /// - keys: The keys of lists in Redis that should be popped from.
422
+ /// - timeout: The time (in seconds) to wait. `0` means indefinitely.
423
+ /// - Returns:
424
+ /// If timeout was reached, `nil`.
425
+ ///
426
+ /// Otherwise, the key of the list the element was removed from and the popped element.
427
+ @inlinable
428
+ public func blpop( from keys: String ... , timeout: Int = 0 ) -> EventLoopFuture < ( String , RESPValue ) ? > {
429
+ return self . blpop ( from: keys, timeout: timeout)
430
+ }
387
431
388
432
/// Removes the last element of a list, blocking until an element is available.
389
433
///
@@ -422,13 +466,32 @@ extension RedisClient {
422
466
///
423
467
/// Otherwise, the key of the list the element was removed from and the popped element.
424
468
@inlinable
425
- public func brpop(
426
- from keys: [ String ] ,
427
- timeout: Int = 0
428
- ) -> EventLoopFuture < ( String , RESPValue ) ? > {
469
+ public func brpop( from keys: [ String ] , timeout: Int = 0 ) -> EventLoopFuture < ( String , RESPValue ) ? > {
429
470
return _bpop ( command: " BRPOP " , keys, timeout)
430
471
}
431
472
473
+ /// Removes the last element of a list, blocking until an element is available.
474
+ ///
475
+ /// - Important:
476
+ /// This will block the connection from completing further commands until an element
477
+ /// is available to pop from the group of lists.
478
+ ///
479
+ /// It is **highly** recommended to set a reasonable `timeout`
480
+ /// or to use the non-blocking `rpop` method where possible.
481
+ ///
482
+ /// See [https://redis.io/commands/brpop](https://redis.io/commands/brpop)
483
+ /// - Parameters:
484
+ /// - keys: The keys of lists in Redis that should be popped from.
485
+ /// - timeout: The time (in seconds) to wait. `0` means indefinitely.
486
+ /// - Returns:
487
+ /// If timeout was reached, `nil`.
488
+ ///
489
+ /// Otherwise, the key of the list the element was removed from and the popped element.
490
+ @inlinable
491
+ public func brpop( from keys: String ... , timeout: Int = 0 ) -> EventLoopFuture < ( String , RESPValue ) ? > {
492
+ return self . brpop ( from: keys, timeout: timeout)
493
+ }
494
+
432
495
@usableFromInline
433
496
func _bpop(
434
497
command: String ,
0 commit comments