Skip to content

[AFC] Pipelining

This was originally proposed by @John-Connolly to Vapor/Redis.

Problem Statement

It would be nice to have a way to send multiple commands at once. This api feels a bit out of place now in vapor 3 but something similar would be nice.

An example of nicer usage:

let getCommands: [RedisCommand] = names.map { .get("key_\($0)") }
let result = connection.send(getCommands)

Proposed Solution

let pipeline = connection.makePipeline()
 let result = try pipeline
         .enqueue(command: "SET", arguments: ["KEY", "VALUE"])
         .enqueue(command: "INCR", arguments: ["COUNT"])
         .execute() // Future<[RedisData]>

Alternatives

N/A

Edited by Nathan Harris
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information