The examples use Scala code, but the issue would be the same with Java.
Way back in version 2 of Jedis, you could use echo
in a pipeline:
import redis.clients.jedis._
object Main {
def main(args: Array[String]): Unit = {
val jedis = new Jedis("redis://localhost:6379/0")
val pipe = jedis.pipelined()
pipe.echo("Hello, Redis!")
val response = pipe.syncAndReturnAll()
println(response.get(0))
}
}
But echo
has been removed from pipelines.
The only replacement seems to be pipe.sendCommand(Protocol.Command.ECHO, "Hello, Redis!")
, but this will give you back an array of bytes, not a string.
Is there still an easy way to use echo
so that it immediately returns a string and we don't have to do a conversion afterwards?
You can try the following:
pipe.executeCommand(new CommandObject(new CommandArguments(Protocol.Command.ECHO).add("Hello, Redis!"), BuilderFactory.STRING))
You can also ask to add it back, preferably with the explanation of your use case.