Package io.vertx.redis.client
Interface Redis
-
public interface RedisA simple Redis client.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract 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 RediscreateClient(Vertx vertx)Create a new Redis client using the default client options.static RediscreateClient(Vertx vertx, RedisOptions options)Create a new Redis client using the given client options.static RediscreateClient(Vertx vertx, String connectionString)Create a new Redis client using the default client options.static RediscreateClusterClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisClusterConnectOptions>> connectOptions)Creates a new cluster Redis client.static RediscreateReplicationClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisReplicationConnectOptions>> connectOptions)Creates a new replication Redis client.static RediscreateSentinelClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisSentinelConnectOptions>> connectOptions)Creates a new sentinel Redis client.static RediscreateStandaloneClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisStandaloneConnectOptions>> connectOptions)Creates a new standalone Redis client.Future<Response>send(Request command)Send the given command to the Redis server or cluster.
-
-
-
Method Detail
-
createClient
static Redis createClient(Vertx vertx)
Create a new Redis client using the default client options.- Parameters:
vertx- the vertx instance- Returns:
- the client
-
createClient
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:
connectionString- a string URI following the scheme: redis://[username:password@][host][:port][/database]vertx- the vertx instance- Returns:
- the client
- See Also:
- Redis scheme on iana.org
-
createClient
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
static Redis createStandaloneClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisStandaloneConnectOptions>> connectOptions)
Creates a new standalone Redis client. Theoptionsare used to obtainRedisOptions.getType(),RedisOptions.getNetClientOptions(),RedisOptions.getPoolOptions()andRedisOptions.getTracingPolicy(). TheconnectOptionsare 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
static Redis createReplicationClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisReplicationConnectOptions>> connectOptions)
Creates a new replication Redis client. Theoptionsare used to obtainRedisOptions.getType(),RedisOptions.getNetClientOptions(),RedisOptions.getPoolOptions()andRedisOptions.getTracingPolicy(). TheconnectOptionsare 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
static Redis createSentinelClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisSentinelConnectOptions>> connectOptions)
Creates a new sentinel Redis client. Theoptionsare used to obtainRedisOptions.getType(),RedisOptions.getNetClientOptions(),RedisOptions.getPoolOptions()andRedisOptions.getTracingPolicy(). TheconnectOptionsare 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
static Redis createClusterClient(Vertx vertx, RedisOptions options, Supplier<Future<RedisClusterConnectOptions>> connectOptions)
Creates a new cluster Redis client. Theoptionsare used to obtainRedisOptions.getType(),RedisOptions.getNetClientOptions(),RedisOptions.getPoolOptions()andRedisOptions.getTracingPolicy(). TheconnectOptionsare 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
Future<RedisConnection> connect()
Connects to the Redis server.- Returns:
- a future with the result of the operation
-
send
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
-
-