Package io.vertx.reactivex.redis.client
Class Redis
- java.lang.Object
-
- io.vertx.reactivex.redis.client.Redis
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<Redis>
__TYPE_ARG
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Future<List<Response>>
batch(List<Request> commands)
Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.Future<Void>
close()
Closes the client and terminates any connection.Future<RedisConnection>
connect()
Connects to the Redis server.static Redis
createClient(Vertx vertx)
Create a new Redis client using the default client options.static Redis
createClient(Vertx vertx, RedisOptions options)
Create a new Redis client using the given client options.static Redis
createClient(Vertx vertx, String connectionString)
Create a new Redis client using the default client options.static Redis
createClusterClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisClusterConnectOptions>> connectOptions)
Creates a new cluster Redis client.static Redis
createReplicationClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisReplicationConnectOptions>> connectOptions)
Creates a new replication Redis client.static Redis
createSentinelClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisSentinelConnectOptions>> connectOptions)
Creates a new sentinel Redis client.static Redis
createStandaloneClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisStandaloneConnectOptions>> connectOptions)
Creates a new standalone Redis client.boolean
equals(Object o)
Redis
getDelegate()
int
hashCode()
static Redis
newInstance(Redis arg)
Single<List<Response>>
rxBatch(List<Request> commands)
Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.Completable
rxClose()
Closes the client and terminates any connection.Single<RedisConnection>
rxConnect()
Connects to the Redis server.Maybe<Response>
rxSend(Request command)
Send the given command to the Redis server or cluster.Future<Response>
send(Request command)
Send the given command to the Redis server or cluster.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<Redis> __TYPE_ARG
-
-
Method Detail
-
getDelegate
public Redis getDelegate()
-
createClient
public static Redis createClient(Vertx vertx)
Create a new Redis client using the default client options.- Parameters:
vertx
- the vertx instance- Returns:
- the client
-
createClient
public static Redis createClient(Vertx vertx, String connectionString)
Create a new Redis client using the default client options. Does not support rediss (redis over ssl scheme) for now.- Parameters:
vertx
- the vertx instanceconnectionString
- a string URI following the scheme: redis://[username:password@][host][:port][/database]- Returns:
- the client
-
createClient
public static Redis createClient(Vertx vertx, RedisOptions options)
Create a new Redis client using the given client options.- Parameters:
vertx
- the Vert.x instanceoptions
- the user provided options- Returns:
- the client
-
createStandaloneClient
public static Redis createStandaloneClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisStandaloneConnectOptions>> connectOptions)
Creates a new standalone Redis client. Theoptions
are used to obtainRedisOptions
,RedisOptions
,RedisOptions
andRedisOptions
. TheconnectOptions
are queried for every connection attempt.If
options.getType() != RedisClientType.STANDALONE
, an exception is thrown.- Parameters:
vertx
- the Vert.x instanceoptions
- the static optionsconnectOptions
- supplier of the dynamic options- Returns:
- the standalone client
-
createReplicationClient
public static Redis createReplicationClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisReplicationConnectOptions>> connectOptions)
Creates a new replication Redis client. Theoptions
are used to obtainRedisOptions
,RedisOptions
,RedisOptions
andRedisOptions
. TheconnectOptions
are queried for every connection attempt.If
options.getType() != RedisClientType.REPLICATION
, an exception is thrown.- Parameters:
vertx
- the Vert.x instanceoptions
- the static optionsconnectOptions
- supplier of the dynamic options- Returns:
- the replication client
-
createSentinelClient
public static Redis createSentinelClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisSentinelConnectOptions>> connectOptions)
Creates a new sentinel Redis client. Theoptions
are used to obtainRedisOptions
,RedisOptions
,RedisOptions
andRedisOptions
. TheconnectOptions
are queried for every connection attempt.If
options.getType() != RedisClientType.SENTINEL
, an exception is thrown.- Parameters:
vertx
- the Vert.x instanceoptions
- the static optionsconnectOptions
- supplier of the dynamic options- Returns:
- the sentinel client
-
createClusterClient
public static Redis createClusterClient(Vertx vertx, RedisOptions options, java.util.function.Supplier<Future<RedisClusterConnectOptions>> connectOptions)
Creates a new cluster Redis client. Theoptions
are used to obtainRedisOptions
,RedisOptions
,RedisOptions
andRedisOptions
. TheconnectOptions
are queried for every connection attempt.If
options.getType() != RedisClientType.CLUSTER
, an exception is thrown.- Parameters:
vertx
- the Vert.x instanceoptions
- the static optionsconnectOptions
- supplier of the dynamic options- Returns:
- the cluster client
-
connect
public Future<RedisConnection> connect()
Connects to the Redis server.- Returns:
- a future with the result of the operation
-
rxConnect
public Single<RedisConnection> rxConnect()
Connects to the Redis server.- Returns:
- a future with the result of the operation
-
rxClose
public Completable rxClose()
Closes the client and terminates any connection.- Returns:
-
send
public Future<Response> send(Request command)
Send the given command to the Redis server or cluster.- Parameters:
command
- the command to send- Returns:
- a future with the result of the operation
-
rxSend
public Maybe<Response> rxSend(Request command)
Send the given command to the Redis server or cluster.- Parameters:
command
- the command to send- Returns:
- a future with the result of the operation
-
batch
public Future<List<Response>> batch(List<Request> commands)
Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.- Parameters:
commands
- list of command to send- Returns:
- a future with the result of the operation
-
rxBatch
public Single<List<Response>> rxBatch(List<Request> commands)
Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.- Parameters:
commands
- list of command to send- Returns:
- a future with the result of the operation
-
-