In the user facing API you don't want:
connection.do(.get("key")) // what about the result?
But just:
connection.get("key") // => promise or callback
The enum dupes quite a bit. Though the same is true for NIO HTTP :->
A Redis command call is just a regular RESP array where the first element is the command key.
For queuing commands I have this RedisCommand object which is a little like your enum. I guess one might potentially save an (array) alloc because your enum might directly encode the parameters for short commands. So maybe it is indeed a good idea despite all the extra code!
For queuing I have this thing: RedisCommandCall which bundles the command with the associated promise. /shrug
BTW: If the enum is done, this:
public enum RESPCommand {
case get(RESPValueConvertible)
}
should probably be
public enum RESPCommand {
case get(RESPStringConvertible) // ???
}
because the various commands do expect certain types, not just arbitrary RESP representable values.
P.S.: ... just ideas as usual.