@@ -161,19 +161,19 @@ extension RedisClient {
161
161
/// - Parameters:
162
162
/// - source: The key of the list to pop from.
163
163
/// - dest: The key of the list to push to.
164
- /// - timeout: The time (in seconds) to wait . `0` means indefinitely.
164
+ /// - timeout: The max time to wait for a value to use . `0` seconds means to wait indefinitely.
165
165
/// - Returns: The element popped from the source list and pushed to the destination,
166
166
/// or `nil` if the timeout was reached.
167
167
@inlinable
168
168
public func brpoplpush(
169
169
from source: RedisKey ,
170
170
to dest: RedisKey ,
171
- timeout: Int = 0
171
+ timeout: TimeAmount = . seconds ( 0 )
172
172
) -> EventLoopFuture < RESPValue ? > {
173
173
let args : [ RESPValue ] = [
174
174
. init( bulk: source) ,
175
175
. init( bulk: dest) ,
176
- . init( bulk: timeout)
176
+ . init( bulk: timeout. seconds )
177
177
]
178
178
return send ( command: " BRPOPLPUSH " , with: args)
179
179
. map { $0. isNull ? nil : $0 }
@@ -378,9 +378,10 @@ extension RedisClient {
378
378
/// See [https://redis.io/commands/blpop](https://redis.io/commands/blpop)
379
379
/// - Parameters:
380
380
/// - key: The key of the list to pop from.
381
+ /// - timeout: The max time to wait for a value to use. `0`seconds means to wait indefinitely.
381
382
/// - Returns: The element that was popped from the list, or `nil` if the timout was reached.
382
383
@inlinable
383
- public func blpop( from key: RedisKey , timeout: Int = 0 ) -> EventLoopFuture < RESPValue ? > {
384
+ public func blpop( from key: RedisKey , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < RESPValue ? > {
384
385
return blpop ( from: [ key] , timeout: timeout)
385
386
. map { $0? . 1 }
386
387
}
@@ -397,13 +398,13 @@ extension RedisClient {
397
398
/// See [https://redis.io/commands/blpop](https://redis.io/commands/blpop)
398
399
/// - Parameters:
399
400
/// - keys: The keys of lists in Redis that should be popped from.
400
- /// - timeout: The time (in seconds) to wait . `0` means indefinitely.
401
+ /// - timeout: The max time to wait for a value to use . `0`seconds means to wait indefinitely.
401
402
/// - Returns:
402
403
/// If timeout was reached, `nil`.
403
404
///
404
405
/// Otherwise, the key of the list the element was removed from and the popped element.
405
406
@inlinable
406
- public func blpop( from keys: [ RedisKey ] , timeout: Int = 0 ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
407
+ public func blpop( from keys: [ RedisKey ] , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
407
408
return _bpop ( command: " BLPOP " , keys, timeout)
408
409
}
409
410
@@ -419,13 +420,13 @@ extension RedisClient {
419
420
/// See [https://redis.io/commands/blpop](https://redis.io/commands/blpop)
420
421
/// - Parameters:
421
422
/// - keys: The keys of lists in Redis that should be popped from.
422
- /// - timeout: The time (in seconds) to wait . `0` means indefinitely.
423
+ /// - timeout: The max time to wait for a value to use . `0`seconds means to wait indefinitely.
423
424
/// - Returns:
424
425
/// If timeout was reached, `nil`.
425
426
///
426
427
/// Otherwise, the key of the list the element was removed from and the popped element.
427
428
@inlinable
428
- public func blpop( from keys: RedisKey ... , timeout: Int = 0 ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
429
+ public func blpop( from keys: RedisKey ... , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
429
430
return self . blpop ( from: keys, timeout: timeout)
430
431
}
431
432
@@ -441,9 +442,10 @@ extension RedisClient {
441
442
/// See [https://redis.io/commands/brpop](https://redis.io/commands/brpop)
442
443
/// - Parameters:
443
444
/// - key: The key of the list to pop from.
445
+ /// - timeout: The max time to wait for a value to use. `0`seconds means to wait indefinitely.
444
446
/// - Returns: The element that was popped from the list, or `nil` if the timout was reached.
445
447
@inlinable
446
- public func brpop( from key: RedisKey , timeout: Int = 0 ) -> EventLoopFuture < RESPValue ? > {
448
+ public func brpop( from key: RedisKey , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < RESPValue ? > {
447
449
return brpop ( from: [ key] , timeout: timeout)
448
450
. map { $0? . 1 }
449
451
}
@@ -460,13 +462,13 @@ extension RedisClient {
460
462
/// See [https://redis.io/commands/brpop](https://redis.io/commands/brpop)
461
463
/// - Parameters:
462
464
/// - keys: The keys of lists in Redis that should be popped from.
463
- /// - timeout: The time (in seconds) to wait . `0` means indefinitely.
465
+ /// - timeout: The max time to wait for a value to use . `0`seconds means to wait indefinitely.
464
466
/// - Returns:
465
467
/// If timeout was reached, `nil`.
466
468
///
467
469
/// Otherwise, the key of the list the element was removed from and the popped element.
468
470
@inlinable
469
- public func brpop( from keys: [ RedisKey ] , timeout: Int = 0 ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
471
+ public func brpop( from keys: [ RedisKey ] , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
470
472
return _bpop ( command: " BRPOP " , keys, timeout)
471
473
}
472
474
@@ -482,24 +484,24 @@ extension RedisClient {
482
484
/// See [https://redis.io/commands/brpop](https://redis.io/commands/brpop)
483
485
/// - Parameters:
484
486
/// - keys: The keys of lists in Redis that should be popped from.
485
- /// - timeout: The time (in seconds) to wait . `0` means indefinitely.
487
+ /// - timeout: The max time to wait for a value to use . `0`seconds means to wait indefinitely.
486
488
/// - Returns:
487
489
/// If timeout was reached, `nil`.
488
490
///
489
491
/// Otherwise, the key of the list the element was removed from and the popped element.
490
492
@inlinable
491
- public func brpop( from keys: RedisKey ... , timeout: Int = 0 ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
493
+ public func brpop( from keys: RedisKey ... , timeout: TimeAmount = . seconds ( 0 ) ) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
492
494
return self . brpop ( from: keys, timeout: timeout)
493
495
}
494
496
495
497
@usableFromInline
496
498
func _bpop(
497
499
command: String ,
498
500
_ keys: [ RedisKey ] ,
499
- _ timeout: Int
501
+ _ timeout: TimeAmount
500
502
) -> EventLoopFuture < ( RedisKey , RESPValue ) ? > {
501
503
var args = keys. map ( RESPValue . init)
502
- args. append ( . init( bulk: timeout) )
504
+ args. append ( . init( bulk: timeout. seconds ) )
503
505
504
506
return send ( command: command, with: args)
505
507
. flatMapThrowing {
0 commit comments