Skip to content

Commit 0f7b53f

Browse files
authored
Merge pull request #24 from Mordil/redis-client
Simplify `RedisCommandExecutor` and `RedisConnection`
2 parents 869625d + 9f049eb commit 0f7b53f

15 files changed

+107
-98
lines changed

Sources/NIORedis/Commands/BasicCommands.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import NIO
33

4-
extension RedisCommandExecutor {
4+
extension RedisClient {
55
/// Echos the provided message through the Redis instance.
66
///
77
/// See [https://redis.io/commands/echo](https://redis.io/commands/echo)
@@ -95,7 +95,7 @@ extension RedisCommandExecutor {
9595

9696
// MARK: Scan
9797

98-
extension RedisCommandExecutor {
98+
extension RedisClient {
9999
/// Incrementally iterates over all keys in the currently selected database.
100100
///
101101
/// [https://redis.io/commands/scan](https://redis.io/commands/scan)

Sources/NIORedis/Commands/HashCommands.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import NIO
22

33
// MARK: Static Helpers
44

5-
extension RedisCommandExecutor {
5+
extension RedisClient {
66
@usableFromInline
77
static func _mapHashResponse(_ values: [String]) -> [String: String] {
88
guard values.count > 0 else { return [:] }
@@ -23,7 +23,7 @@ extension RedisCommandExecutor {
2323

2424
// MARK: General
2525

26-
extension RedisCommandExecutor {
26+
extension RedisClient {
2727
/// Removes the specified fields from a hash.
2828
///
2929
/// See [https://redis.io/commands/hdel](https://redis.io/commands/hdel)
@@ -125,7 +125,7 @@ extension RedisCommandExecutor {
125125

126126
// MARK: Set
127127

128-
extension RedisCommandExecutor {
128+
extension RedisClient {
129129
/// Sets a hash field to the value specified.
130130
/// - Note: If you do not want to overwrite existing values, use `hsetnx(_:field:to:)`.
131131
///
@@ -192,7 +192,7 @@ extension RedisCommandExecutor {
192192

193193
// MARK: Get
194194

195-
extension RedisCommandExecutor {
195+
extension RedisClient {
196196
/// Gets a hash field's value.
197197
///
198198
/// See [https://redis.io/commands/hget](https://redis.io/commands/hget)
@@ -237,7 +237,7 @@ extension RedisCommandExecutor {
237237

238238
// MARK: Increment
239239

240-
extension RedisCommandExecutor {
240+
extension RedisClient {
241241
/// Increments a hash field's value and returns the new value.
242242
///
243243
/// See [https://redis.io/commands/hincrby](https://redis.io/commands/hincrby)

Sources/NIORedis/Commands/ListCommands.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import NIO
22

33
// MARK: General
44

5-
extension RedisCommandExecutor {
5+
extension RedisClient {
66
/// Gets the length of a list.
77
///
88
/// See [https://redis.io/commands/llen](https://redis.io/commands/llen)
@@ -107,7 +107,7 @@ extension RedisCommandExecutor {
107107

108108
// MARK: Insert
109109

110-
extension RedisCommandExecutor {
110+
extension RedisClient {
111111
/// Inserts the element before the first element matching the "pivot" value specified.
112112
///
113113
/// See [https://redis.io/commands/linsert](https://redis.io/commands/linsert)
@@ -152,7 +152,7 @@ extension RedisCommandExecutor {
152152

153153
// MARK: Head Operations
154154

155-
extension RedisCommandExecutor {
155+
extension RedisClient {
156156
/// Removes the first element of a list.
157157
///
158158
/// See [https://redis.io/commands/lpop](https://redis.io/commands/lpop)
@@ -196,7 +196,7 @@ extension RedisCommandExecutor {
196196

197197
// MARK: Tail Operations
198198

199-
extension RedisCommandExecutor {
199+
extension RedisClient {
200200
/// Removes the last element a list.
201201
///
202202
/// See [https://redis.io/commands/rpop](https://redis.io/commands/rpop)

Sources/NIORedis/Commands/SetCommands.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import NIO
33

44
// MARK: General
55

6-
extension RedisCommandExecutor {
6+
extension RedisClient {
77
/// Gets all of the elements contained in a set.
88
/// - Note: Ordering of results are stable between multiple calls of this method to the same set.
99
///
@@ -152,7 +152,7 @@ extension RedisCommandExecutor {
152152

153153
// MARK: Diff
154154

155-
extension RedisCommandExecutor {
155+
extension RedisClient {
156156
/// Calculates the difference between two or more sets.
157157
///
158158
/// See [https://redis.io/commands/sdiff](https://redis.io/commands/sdiff)
@@ -185,7 +185,7 @@ extension RedisCommandExecutor {
185185

186186
// MARK: Intersect
187187

188-
extension RedisCommandExecutor {
188+
extension RedisClient {
189189
/// Calculates the intersection of two or more sets.
190190
///
191191
/// See [https://redis.io/commands/sinter](https://redis.io/commands/sinter)
@@ -218,7 +218,7 @@ extension RedisCommandExecutor {
218218

219219
// MARK: Union
220220

221-
extension RedisCommandExecutor {
221+
extension RedisClient {
222222
/// Calculates the union of two or more sets.
223223
///
224224
/// See [https://redis.io/commands/sunion](https://redis.io/commands/sunion)

Sources/NIORedis/Commands/SortedSetCommands.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import NIO
22

33
// MARK: Static Helpers
44

5-
extension RedisCommandExecutor {
5+
extension RedisClient {
66
@usableFromInline
77
static func _mapSortedSetResponse(
88
_ response: [RESPValue],
@@ -32,7 +32,7 @@ extension RedisCommandExecutor {
3232

3333
// MARK: General
3434

35-
extension RedisCommandExecutor {
35+
extension RedisClient {
3636
/// Adds elements to a sorted set, assigning their score to the values provided.
3737
///
3838
/// See [https://redis.io/commands/zadd](https://redis.io/commands/zadd)
@@ -140,7 +140,7 @@ extension RedisCommandExecutor {
140140

141141
// MARK: Rank
142142

143-
extension RedisCommandExecutor {
143+
extension RedisClient {
144144
/// Returns the rank (index) of the specified element in a sorted set.
145145
/// - Note: This treats the ordered set as ordered from low to high.
146146
/// For the inverse, see `zrevrank(of:in:)`.
@@ -174,7 +174,7 @@ extension RedisCommandExecutor {
174174

175175
// MARK: Count
176176

177-
extension RedisCommandExecutor {
177+
extension RedisClient {
178178
/// Returns the number of elements in a sorted set with a score within the range specified.
179179
///
180180
/// See [https://redis.io/commands/zcount](https://redis.io/commands/zcount)
@@ -211,7 +211,7 @@ extension RedisCommandExecutor {
211211

212212
// MARK: Pop
213213

214-
extension RedisCommandExecutor {
214+
extension RedisClient {
215215
/// Removes elements from a sorted set with the lowest scores.
216216
///
217217
/// See [https://redis.io/commands/zpopmin](https://redis.io/commands/zpopmin)
@@ -280,7 +280,7 @@ extension RedisCommandExecutor {
280280

281281
// MARK: Increment
282282

283-
extension RedisCommandExecutor {
283+
extension RedisClient {
284284
/// Increments the score of the specified element in a sorted set.
285285
///
286286
/// See [https://redis.io/commands/zincrby](https://redis.io/commands/zincrby)
@@ -302,7 +302,7 @@ extension RedisCommandExecutor {
302302

303303
// MARK: Intersect and Union
304304

305-
extension RedisCommandExecutor {
305+
extension RedisClient {
306306
/// Calculates the union of two or more sorted sets and stores the result.
307307
/// - Note: This operation overwrites any value stored at the destination key.
308308
///
@@ -377,7 +377,7 @@ extension RedisCommandExecutor {
377377

378378
// MARK: Range
379379

380-
extension RedisCommandExecutor {
380+
extension RedisClient {
381381
/// Gets the specified range of elements in a sorted set.
382382
/// - Note: This treats the ordered set as ordered from low to high.
383383
///
@@ -437,7 +437,7 @@ extension RedisCommandExecutor {
437437

438438
// MARK: Range by Score
439439

440-
extension RedisCommandExecutor {
440+
extension RedisClient {
441441
/// Gets elements from a sorted set whose score fits within the range specified.
442442
/// - Note: This treats the ordered set as ordered from low to high.
443443
///
@@ -506,7 +506,7 @@ extension RedisCommandExecutor {
506506

507507
// MARK: Range by Lexiographical
508508

509-
extension RedisCommandExecutor {
509+
extension RedisClient {
510510
/// Gets elements from a sorted set whose lexiographical values are between the range specified.
511511
/// - Important: This assumes all elements in the sorted set have the same score. If not, the returned elements are unspecified.
512512
/// - Note: This treats the ordered set as ordered from low to high.
@@ -570,7 +570,7 @@ extension RedisCommandExecutor {
570570

571571
// MARK: Remove
572572

573-
extension RedisCommandExecutor {
573+
extension RedisClient {
574574
/// Removes the specified elements from a sorted set.
575575
///
576576
/// See [https://redis.io/commands/zrem](https://redis.io/commands/zrem)

Sources/NIORedis/Commands/StringCommands.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import NIO
22

33
// MARK: Get
44

5-
extension RedisCommandExecutor {
5+
extension RedisClient {
66
/// Get the value of a key.
77
/// - Note: This operation only works with string values.
88
/// The `EventLoopFuture` will fail with a `RedisError` if the value is not a string, such as a Set.
@@ -32,7 +32,7 @@ extension RedisCommandExecutor {
3232

3333
// MARK: Set
3434

35-
extension RedisCommandExecutor {
35+
extension RedisClient {
3636
/// Sets the value stored in the key provided, overwriting the previous value.
3737
///
3838
/// Any previous expiration set on the key is discarded if the SET operation was successful.
@@ -93,7 +93,7 @@ extension RedisCommandExecutor {
9393

9494
// MARK: Increment
9595

96-
extension RedisCommandExecutor {
96+
extension RedisClient {
9797
/// Increments the stored value by 1.
9898
///
9999
/// See [https://redis.io/commands/incr](https://redis.io/commands/incr)
@@ -136,7 +136,7 @@ extension RedisCommandExecutor {
136136

137137
// MARK: Decrement
138138

139-
extension RedisCommandExecutor {
139+
extension RedisClient {
140140
/// Decrements the stored value by 1.
141141
///
142142
/// See [https://redis.io/commands/decr](https://redis.io/commands/decr)

0 commit comments

Comments
 (0)