java.lang.Object
io.lettuce.core.sentinel.RedisSentinelAsyncCommandsImpl<K,V>
- Type Parameters:
K- Key type.V- Value type.
- All Implemented Interfaces:
RedisSentinelAsyncCommands<K,V>
public class RedisSentinelAsyncCommandsImpl<K,V> extends Object implements RedisSentinelAsyncCommands<K,V>
An asynchronous and thread-safe API for a Redis Sentinel connection.
- Since:
- 3.0
- Author:
- Mark Paluch
-
Constructor Summary
Constructors Constructor Description RedisSentinelAsyncCommandsImpl(StatefulConnection<K,V> connection, RedisCodec<K,V> codec) -
Method Summary
Modifier and Type Method Description RedisFuture<K>clientGetname()Get the current connection name.RedisFuture<Long>clientKill(KillArgs killArgs)Kill connections of clients which are filtered bykillArgs.RedisFuture<String>clientKill(String addr)Kill the connection of a client identified by ip:port.RedisFuture<String>clientList()Get the list of client connections.RedisFuture<String>clientPause(long timeout)Stop processing commands from clients for some time.RedisFuture<String>clientSetname(K name)Set the current connection name.voidclose()<T> RedisFuture<T>dispatch(ProtocolKeyword type, CommandOutput<K,V,T> output)Dispatch a command to the Redis Server.<T> RedisFuture<T>dispatch(ProtocolKeyword type, CommandOutput<K,V,T> output, CommandArgs<K,V> args)Dispatch a command to the Redis Server.<T> AsyncCommand<K,V,T>dispatch(RedisCommand<K,V,T> cmd)RedisFuture<String>failover(K key)Perform a failover.RedisFuture<SocketAddress>getMasterAddrByName(K key)Return the ip and port number of the master with that name.StatefulRedisSentinelConnection<K,V>getStatefulConnection()RedisFuture<String>info()Get information and statistics about the server.RedisFuture<String>info(String section)Get information and statistics about the server.booleanisOpen()RedisFuture<Map<K,V>>master(K key)Show the state and info of the specified master.RedisFuture<List<Map<K,V>>>masters()Enumerates all the monitored masters and their states.RedisFuture<String>monitor(K key, String ip, int port, int quorum)This command tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum.RedisFuture<String>ping()Ping the server.RedisFuture<String>remove(K key)remove the specified master.RedisFuture<Long>reset(K key)This command will reset all the masters with matching name.RedisFuture<String>set(K key, String option, V value)Multiple option / value pairs can be specified (or none at all).RedisFuture<List<Map<K,V>>>slaves(K key)Provides a list of replicas for the master with the specified name.
-
Constructor Details
-
RedisSentinelAsyncCommandsImpl
-
-
Method Details
-
getMasterAddrByName
Description copied from interface:RedisSentinelAsyncCommandsReturn the ip and port number of the master with that name.- Specified by:
getMasterAddrByNamein interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.- Returns:
- SocketAddress.
-
masters
Description copied from interface:RedisSentinelAsyncCommandsEnumerates all the monitored masters and their states.- Specified by:
mastersin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- Map<K, V>>.
-
master
Description copied from interface:RedisSentinelAsyncCommandsShow the state and info of the specified master.- Specified by:
masterin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.- Returns:
- Map<K, V>.
-
slaves
Description copied from interface:RedisSentinelAsyncCommandsProvides a list of replicas for the master with the specified name.- Specified by:
slavesin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.- Returns:
- List<Map<K, V>>.
-
reset
Description copied from interface:RedisSentinelAsyncCommandsThis command will reset all the masters with matching name.- Specified by:
resetin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.- Returns:
- Long.
-
failover
Description copied from interface:RedisSentinelAsyncCommandsPerform a failover.- Specified by:
failoverin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the master id.- Returns:
- String.
-
monitor
Description copied from interface:RedisSentinelAsyncCommandsThis command tells the Sentinel to start monitoring a new master with the specified name, ip, port, and quorum.- Specified by:
monitorin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.ip- the IP address.port- the port.quorum- the quorum count.- Returns:
- String.
-
set
Description copied from interface:RedisSentinelAsyncCommandsMultiple option / value pairs can be specified (or none at all).- Specified by:
setin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.option- the option.value- the value.- Returns:
- String simple-string-reply
OKifSETwas executed correctly.
-
remove
Description copied from interface:RedisSentinelAsyncCommandsremove the specified master.- Specified by:
removein interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
key- the key.- Returns:
- String.
-
ping
Description copied from interface:RedisSentinelAsyncCommandsPing the server.- Specified by:
pingin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- String simple-string-reply.
-
clientGetname
Description copied from interface:RedisSentinelAsyncCommandsGet the current connection name.- Specified by:
clientGetnamein interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- K bulk-string-reply The connection name, or a null bulk reply if no name is set.
-
clientSetname
Description copied from interface:RedisSentinelAsyncCommandsSet the current connection name.- Specified by:
clientSetnamein interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
name- the client name.- Returns:
- simple-string-reply
OKif the connection name was successfully set.
-
clientKill
Description copied from interface:RedisSentinelAsyncCommandsKill the connection of a client identified by ip:port.- Specified by:
clientKillin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
addr- ip:port.- Returns:
- String simple-string-reply
OKif the connection exists and has been closed.
-
clientKill
Description copied from interface:RedisSentinelAsyncCommandsKill connections of clients which are filtered bykillArgs.- Specified by:
clientKillin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
killArgs- args for the kill operation.- Returns:
- Long integer-reply number of killed connections.
-
clientPause
Description copied from interface:RedisSentinelAsyncCommandsStop processing commands from clients for some time.- Specified by:
clientPausein interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
timeout- the timeout value in milliseconds.- Returns:
- String simple-string-reply The command returns OK or an error if the timeout is invalid.
-
clientList
Description copied from interface:RedisSentinelAsyncCommandsGet the list of client connections.- Specified by:
clientListin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- String bulk-string-reply a unique string, formatted as follows: One client connection per line (separated by LF), each line is composed of a succession of property=value fields separated by a space character.
-
info
Description copied from interface:RedisSentinelAsyncCommandsGet information and statistics about the server.- Specified by:
infoin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- String bulk-string-reply as a collection of text lines.
-
info
Description copied from interface:RedisSentinelAsyncCommandsGet information and statistics about the server.- Specified by:
infoin interfaceRedisSentinelAsyncCommands<K,V>- Parameters:
section- the section type: string.- Returns:
- String bulk-string-reply as a collection of text lines.
-
dispatch
Description copied from interface:RedisSentinelAsyncCommandsDispatch a command to the Redis Server. Please note the command output type must fit to the command response.- Specified by:
dispatchin interfaceRedisSentinelAsyncCommands<K,V>- Type Parameters:
T- response type.- Parameters:
type- the command, must not benull.output- the command output, must not benull.- Returns:
- the command response.
-
dispatch
public <T> RedisFuture<T> dispatch(ProtocolKeyword type, CommandOutput<K,V,T> output, CommandArgs<K,V> args)Description copied from interface:RedisSentinelAsyncCommandsDispatch a command to the Redis Server. Please note the command output type must fit to the command response.- Specified by:
dispatchin interfaceRedisSentinelAsyncCommands<K,V>- Type Parameters:
T- response type.- Parameters:
type- the command, must not benull.output- the command output, must not benull.args- the command arguments, must not benull.- Returns:
- the command response.
-
dispatch
-
close
public void close() -
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
trueif the connection is open (connected and not closed).
-
getStatefulConnection
- Specified by:
getStatefulConnectionin interfaceRedisSentinelAsyncCommands<K,V>- Returns:
- the underlying connection.
-