public interface Request
Clients send commands to a Redis server as a RESP Array of Bulk Strings.So all non String/Bulk types will be encoded to Bulk for convenience.
Modifier and Type | Method and Description |
---|---|
Request |
arg(boolean arg)
Adds a boolean encoded to string
|
Request |
arg(Buffer arg)
Adds a String key argument
|
default Request |
arg(byte arg)
Adds a byte encoded to string
|
Request |
arg(byte[] arg)
Adds a byte array
|
default Request |
arg(double arg)
Adds a double encoded to string
|
default Request |
arg(float arg)
Adds a float encoded to string
|
default Request |
arg(int arg)
Adds a int encoded to string
|
default Request |
arg(JsonArray arg)
Adds a JsonArray argument, the encoding will serialize the json as value0, value1, ...
|
default Request |
arg(JsonObject arg)
Adds a JsonObject argument, the encoding will serialize the json as key0, value0, key1, value1, ...
|
Request |
arg(long arg)
Adds a long encoded to string
|
default Request |
arg(short arg)
Adds a short encoded to string
|
default Request |
arg(String arg)
Adds a String argument using UTF8 character encoding
|
default Request |
arg(String arg,
String enc)
Adds a String using a specific character encoding argument
|
static Request |
cmd(Command command)
Creates a new request command.
|
static Request |
cmd(Command command,
Object... args)
|
Command |
command()
Get the Command that is to be used by this request.
|
Request |
nullArg()
Deprecated.
REDIS does not support
null as a parameter, only as response. This was a deviation from the
official protocol which should be avoided. Other clients explicitly do not allow this.
Adds a null encoded string. Redis does not allow storing the null value by itself. This method
will encode any null value as the four character long string "null" .
As a recommendation, this method should not be used directly unless this is the intented behavior. It is present
to handle special cases such as encoding of JsonObject and JsonArray which may contain null values. |
static Request cmd(Command command)
command
- the command to usestatic Request cmd(Command command, Object... args)
Number
, Boolean
, String
,
byte[]
or Buffer
. This factory reduces the GC as it allocates the arguments array with
the right size.command
- the command to useargs
- the fixed list of argumentsRequest arg(byte[] arg)
default Request arg(String arg)
default Request arg(String arg, String enc)
Request arg(long arg)
default Request arg(int arg)
default Request arg(short arg)
default Request arg(byte arg)
default Request arg(float arg)
default Request arg(double arg)
Request arg(boolean arg)
default Request arg(JsonObject arg)
null
values will follow the encoding rules of nullArg()
.IllegalArgumentException
- when values are of type JsonArray or JsonObjectdefault Request arg(JsonArray arg)
null
values will follow the encoding rules of nullArg()
.IllegalArgumentException
- when values are of type JsonArray or JsonObject@Deprecated Request nullArg()
null
as a parameter, only as response. This was a deviation from the
official protocol which should be avoided. Other clients explicitly do not allow this.
Adds a null
encoded string. Redis does not allow storing the null
value by itself. This method
will encode any null value as the four character long string "null"
.
As a recommendation, this method should not be used directly unless this is the intented behavior. It is present
to handle special cases such as encoding of JsonObject
and JsonArray
which may contain null values.Command command()
Copyright © 2023 Eclipse. All rights reserved.