File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Sources/RedisNIO/Commands
Tests/RedisNIOTests/Commands Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -84,11 +84,11 @@ extension RedisClient {
84
84
/// [https://redis.io/commands/expire](https://redis.io/commands/expire)
85
85
/// - Parameters:
86
86
/// - key: The key to set the expiration on.
87
- /// - deadline : The time from now the key will expire at.
87
+ /// - timeout : The time from now the key will expire at.
88
88
/// - Returns: `true` if the expiration was set.
89
89
@inlinable
90
- public func expire( _ key: String , after deadline : TimeAmount ) -> EventLoopFuture < Bool > {
91
- let amount = deadline . nanoseconds / 1_000_000_000
90
+ public func expire( _ key: String , after timeout : TimeAmount ) -> EventLoopFuture < Bool > {
91
+ let amount = timeout . nanoseconds / 1_000_000_000
92
92
return send ( command: " EXPIRE " , with: [ key, amount] )
93
93
. convertFromRESPValue ( to: Int . self)
94
94
. map { return $0 == 1 }
Original file line number Diff line number Diff line change @@ -60,14 +60,14 @@ final class BasicCommandsTests: XCTestCase {
60
60
61
61
func test_expire( ) throws {
62
62
try connection. set ( #function, to: " value " ) . wait ( )
63
- let before = try connection. get ( #function) . wait ( )
64
- XCTAssertNotNil ( before )
65
-
66
- let result = try connection . expire ( #function , after : . nanoseconds ( 1 ) ) . wait ( )
67
- XCTAssertEqual ( result , true )
68
-
69
- let after = try connection. get ( #function) . wait ( )
70
- XCTAssertNil ( after )
63
+ XCTAssertNotNil ( try connection. get ( #function) . wait ( ) )
64
+ XCTAssertTrue ( try connection . expire ( #function , after : . nanoseconds ( 1 ) ) . wait ( ) )
65
+ XCTAssertNil ( try connection . get ( #function ) . wait ( ) )
66
+
67
+ try connection . set ( #function , to : " new value " ) . wait ( )
68
+ XCTAssertNotNil ( try connection . get ( #function ) . wait ( ) )
69
+ XCTAssertTrue ( try connection. expire ( #function, after : . seconds ( 10 ) ) . wait ( ) )
70
+ XCTAssertNotNil ( try connection . get ( #function ) . wait ( ) )
71
71
}
72
72
73
73
func test_ping( ) throws {
You can’t perform that action at this time.
0 commit comments