Interface Request
public interface Request
Builder for Redis requests that will be encoded according to the RESP protocol.
RESP was introduced in Redis 1.2 and became the standard way for talking with the Redis server in Redis 2.0.
Redis protocol documentation states:
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.
- Author:
- Paulo Lopes
-
Method Summary
Modifier and TypeMethodDescriptionarg(boolean arg) Adds a boolean encoded to stringdefault Requestarg(byte arg) Adds a byte encoded to stringarg(byte[] arg) Adds a byte arraydefault Requestarg(double arg) Adds a double encoded to stringdefault Requestarg(float arg) Adds a float encoded to stringdefault Requestarg(int arg) Adds a int encoded to stringarg(long arg) Adds a long encoded to stringdefault Requestarg(short arg) Adds a short encoded to stringAdds a String key argumentdefault RequestAdds a JsonArray argument, the encoding will serialize the json as value0, value1, ... valueN.default Requestarg(JsonObject arg) Adds a JsonObject argument, the encoding will serialize the json as key0, value0, key1, value1, ... keyN, valueN.default RequestAdds a String argument using UTF8 character encodingdefault RequestAdds a String using a specific character encoding argumentstatic RequestCreates a new request.static Requestcommand()Get the Command that is to be used by this request.
-
Method Details
-
cmd
-
cmd
Creates a new request only with simple types of arguments:Number,Boolean,String,byte[]orBuffer. Other kinds of arguments throw an exception.This factory reduces the GC pressure as it allocates the arguments array with the right size.
- Parameters:
command- the command to useargs- the fixed list of arguments- Returns:
- a new request instance
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
-
arg
Adds a JsonObject argument, the encoding will serialize the json as key0, value0, key1, value1, ... keyN, valueN. This is a non-optimized serialization and will just use the string encoding of the values for non buffers.- Returns:
- self
- Throws:
IllegalArgumentException- when values arenullor of type JsonArray or JsonObject
-
arg
Adds a JsonArray argument, the encoding will serialize the json as value0, value1, ... valueN. This is a non-optimized serialization and will just use the string encoding of the values for non buffers.- Returns:
- self
- Throws:
IllegalArgumentException- when values arenullor of type JsonArray or JsonObject
-
command
-