1212//
1313//===----------------------------------------------------------------------===//
1414
15+ import struct Logging. Logger
1516import NIO
1617
1718// MARK: Key
@@ -94,20 +95,34 @@ extension RedisClient {
9495 /// Deletes the given keys. Any key that does not exist is ignored.
9596 ///
9697 /// See ``RedisCommand/.del(keys:)``
97- /// - Parameter keys: The list of keys to delete from the database.
98+ /// - Parameters:
99+ /// - keys: The list of keys to delete from the database.
100+ /// - eventLoop: An optional event loop to hop to for any further chaining on the returned event loop future.
101+ /// - logger: An optional logger instance to use for logs generated from this command.
98102 /// - Returns: A `NIO.EventLoopFuture` that resolves the number of keys that were deleted from the database.
99- public func delete( _ keys: RedisKey ... ) -> EventLoopFuture < Int > {
100- return self . delete ( keys)
103+ public func delete(
104+ _ keys: RedisKey ... ,
105+ eventLoop: EventLoop ? = nil ,
106+ logger: Logger ? = nil
107+ ) -> EventLoopFuture < Int > {
108+ return self . delete ( keys, eventLoop: eventLoop, logger: logger)
101109 }
102110
103111 /// Deletes the given keys. Any key that does not exist is ignored.
104112 ///
105113 /// See ``RedisCommand/del(keys:)``
106- /// - Parameter keys: The list of keys to delete from the database.
114+ /// - Parameters:
115+ /// - keys: The list of keys to delete from the database.
116+ /// - eventLoop: An optional event loop to hop to for any further chaining on the returned event loop future.
117+ /// - logger: An optional logger instance to use for logs generated from this command.
107118 /// - Returns: A `NIO.EventLoopFuture` that resolves the number of keys that were deleted from the database.
108- public func delete( _ keys: [ RedisKey ] ) -> EventLoopFuture < Int > {
119+ public func delete(
120+ _ keys: [ RedisKey ] ,
121+ eventLoop: EventLoop ? = nil ,
122+ logger: Logger ? = nil
123+ ) -> EventLoopFuture < Int > {
109124 guard keys. count > 0 else { return self . eventLoop. makeSucceededFuture ( 0 ) }
110- return self . send ( . del( keys) )
125+ return self . send ( . del( keys) , eventLoop : eventLoop , logger : logger )
111126 }
112127
113128 /// Sets a timeout on key. After the timeout has expired, the key will automatically be deleted.
@@ -116,18 +131,32 @@ extension RedisClient {
116131 /// - Parameters:
117132 /// - key: The key to set the expiration on.
118133 /// - timeout: The time from now the key will expire at.
134+ /// - eventLoop: An optional event loop to hop to for any further chaining on the returned event loop future.
135+ /// - logger: An optional logger instance to use for logs generated from this command.
119136 /// - Returns: A `NIO.EventLoopFuture` that resolves `true` if the expiration was set and `false` if it wasn't.
120- public func expire( _ key: RedisKey , after timeout: TimeAmount ) -> EventLoopFuture < Bool > {
121- return self . send ( . expire( key, after: timeout) )
137+ public func expire(
138+ _ key: RedisKey ,
139+ after timeout: TimeAmount ,
140+ eventLoop: EventLoop ? = nil ,
141+ logger: Logger ? = nil
142+ ) -> EventLoopFuture < Bool > {
143+ return self . send ( . expire( key, after: timeout) , eventLoop: eventLoop, logger: logger)
122144 }
123145
124146 /// Searches the keys in the database that match the given pattern.
125147 ///
126148 /// See ``RedisCommand/keys(matching:)``
127- /// - Parameter pattern: The key pattern to search for matching keys that exist in Redis.
149+ /// - Parameters:
150+ /// - pattern: The key pattern to search for matching keys that exist in Redis.
151+ /// - eventLoop: An optional event loop to hop to for any further chaining on the returned event loop future.
152+ /// - logger: An optional logger instance to use for logs generated from this command.
128153 /// - Returns: A result set of ``RedisKey`` values that exist and match the provided pattern.
129- public func listKeys( matching pattern: String ) -> EventLoopFuture < [ RedisKey ] > {
130- return self . send ( . keys( matching: pattern) )
154+ public func listKeys(
155+ matching pattern: String ,
156+ eventLoop: EventLoop ? = nil ,
157+ logger: Logger ? = nil
158+ ) -> EventLoopFuture < [ RedisKey ] > {
159+ return self . send ( . keys( matching: pattern) , eventLoop: eventLoop, logger: logger)
131160 }
132161
133162 /// Incrementally iterates over all keys in the currently selected database.
@@ -137,12 +166,16 @@ extension RedisClient {
137166 /// - position: The cursor position to start from.
138167 /// - match: A glob-style pattern to filter values to be selected from the result set.
139168 /// - count: The number of elements to advance by. Redis default is 10.
169+ /// - eventLoop: An optional event loop to hop to for any further chaining on the returned event loop future.
170+ /// - logger: An optional logger instance to use for logs generated from this command.
140171 /// - Returns: A cursor position for additional invocations with a limited collection of keys found in the database.
141172 public func scanKeys(
142173 startingFrom position: Int = 0 ,
143174 matching match: String ? = nil ,
144- count: Int ? = nil
175+ count: Int ? = nil ,
176+ eventLoop: EventLoop ? = nil ,
177+ logger: Logger ? = nil
145178 ) -> EventLoopFuture < ( Int , [ RedisKey ] ) > {
146- return self . send ( . scan( startingFrom: position, matching: match, count: count) )
179+ return self . send ( . scan( startingFrom: position, matching: match, count: count) , eventLoop : eventLoop , logger : logger )
147180 }
148181}
0 commit comments