Skip to content

Can't use command convenience methods when trying to pipeline

Many of the command convenience methods attempt to make conversions from RESP to Swift primitives, failing the EventLoopFuture if it can't do it successfully.

This makes doing Redis transactions a major pain:

let results: [RESPValue] = connection.send(command: "MULTI")
    .flatMap { _ in
        // you can't use the convenience method as it expects to get an Int, and Redis returns a "QUEUED" message
        return connection.send(command: "INCR", with: ["my_key"])
    }
    .flatMap { _ in // after each command, Redis will return just a message, so ignore it
        // other stuff
    }
    .flatMap { _ in
        return connection.send(command: "EXEC")
    }
Edited by Nathan Harris
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information