Class RedisStaticMasterReplicaConfiguration
java.lang.Object
org.springframework.data.redis.connection.RedisStaticMasterReplicaConfiguration
- All Implemented Interfaces:
- RedisConfiguration,- RedisConfiguration.StaticMasterReplicaConfiguration,- RedisConfiguration.WithAuthentication,- RedisConfiguration.WithDatabaseIndex,- RedisConfiguration.WithPassword
public class RedisStaticMasterReplicaConfiguration
extends Object
implements RedisConfiguration, RedisConfiguration.StaticMasterReplicaConfiguration
Configuration class used for setting up 
Please also note that a Master/Replica connection cannot be used for Pub/Sub operations.
RedisConnection via RedisConnectionFactory using the provided
 Master / Replica configuration to nodes know to not change address. Eg. when connecting to
 AWS ElastiCache with Read Replicas. Please also note that a Master/Replica connection cannot be used for Pub/Sub operations.
- Since:
- 2.1
- Author:
- Mark Paluch, Christoph Strobl, Tamer Soliman
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisConfigurationRedisConfiguration.ClusterConfiguration, RedisConfiguration.DomainSocketConfiguration, RedisConfiguration.SentinelConfiguration, RedisConfiguration.StaticMasterReplicaConfiguration, RedisConfiguration.WithAuthentication, RedisConfiguration.WithDatabaseIndex, RedisConfiguration.WithDomainSocket, RedisConfiguration.WithHostAndPort, RedisConfiguration.WithPassword
- 
Constructor SummaryConstructorsConstructorDescriptionRedisStaticMasterReplicaConfiguration(String hostName) Create a newRedisConfiguration.StaticMasterReplicaConfigurationgivenhostName.RedisStaticMasterReplicaConfiguration(String hostName, int port) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd anodeto the list of nodes givenhostName.booleanintGet the database index to use.getNodes()Get the RedisPassword to use when connecting.Get the username to use when connecting.inthashCode()Add anodeto the list of nodes givenhostName.voidsetDatabase(int index) Set the database index to use.voidsetPassword(RedisPassword password) Create and set aRedisPasswordfor givenString.voidsetUsername(String username) Create and set a username with the givenString.Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.redis.connection.RedisConfigurationgetDatabaseOrElse, getPasswordOrElseMethods inherited from interface org.springframework.data.redis.connection.RedisConfiguration.WithAuthenticationsetPassword, setPassword
- 
Constructor Details- 
RedisStaticMasterReplicaConfigurationCreate a newRedisConfiguration.StaticMasterReplicaConfigurationgivenhostName.- Parameters:
- hostName- must not be null or empty.
 
- 
RedisStaticMasterReplicaConfiguration- Parameters:
- hostName- must not be null or empty.
- port- a valid TCP port (1-65535).
 
 
- 
- 
Method Details- 
addNodeAdd anodeto the list of nodes givenhostName.- Parameters:
- hostName- must not be null or empty.
- port- a valid TCP port (1-65535).
 
- 
nodeAdd anodeto the list of nodes givenhostName.- Parameters:
- hostName- must not be null or empty.
- Returns:
- this- RedisConfiguration.StaticMasterReplicaConfiguration.
 
- 
node- Parameters:
- hostName- must not be null or empty.
- port- a valid TCP port (1-65535).
- Returns:
- this- RedisConfiguration.StaticMasterReplicaConfiguration.
 
- 
getDatabasepublic int getDatabase()Description copied from interface:RedisConfiguration.WithDatabaseIndexGet the database index to use.- Specified by:
- getDatabasein interface- RedisConfiguration.WithDatabaseIndex
- Returns:
- zeroby default.
 
- 
setDatabasepublic void setDatabase(int index) Description copied from interface:RedisConfiguration.WithDatabaseIndexSet the database index to use.- Specified by:
- setDatabasein interface- RedisConfiguration.WithDatabaseIndex
 
- 
setUsernameDescription copied from interface:RedisConfiguration.WithAuthenticationCreate and set a username with the givenString. Requires Redis 6 or newer.- Specified by:
- setUsernamein interface- RedisConfiguration.WithAuthentication
- Parameters:
- username- the username.
 
- 
getUsernameDescription copied from interface:RedisConfiguration.WithAuthenticationGet the username to use when connecting.- Specified by:
- getUsernamein interface- RedisConfiguration.WithAuthentication
- Returns:
- null if none set.
 
- 
getPasswordDescription copied from interface:RedisConfiguration.WithAuthenticationGet the RedisPassword to use when connecting.- Specified by:
- getPasswordin interface- RedisConfiguration.WithAuthentication
- Returns:
- RedisPassword.none()if none set.
 
- 
setPasswordDescription copied from interface:RedisConfiguration.WithAuthenticationCreate and set aRedisPasswordfor givenString.- Specified by:
- setPasswordin interface- RedisConfiguration.WithAuthentication
- Parameters:
- password- must not be null use- RedisPassword.none()instead.
 
- 
getNodes- Specified by:
- getNodesin interface- RedisConfiguration.StaticMasterReplicaConfiguration
- Returns:
- unmodifiable Listofnodes.
 
- 
equals
- 
hashCodepublic int hashCode()
 
-