Class RedisStandaloneConfiguration
java.lang.Object
org.springframework.data.redis.connection.RedisStandaloneConfiguration
- All Implemented Interfaces:
RedisConfiguration,RedisConfiguration.WithAuthentication,RedisConfiguration.WithDatabaseIndex,RedisConfiguration.WithHostAndPort,RedisConfiguration.WithPassword
public class RedisStandaloneConfiguration
extends Object
implements RedisConfiguration, RedisConfiguration.WithHostAndPort, RedisConfiguration.WithPassword, RedisConfiguration.WithDatabaseIndex
Configuration class used to set up a
RedisConnection with RedisConnectionFactory for connecting
to a single node Redis instance.- Since:
- 2.0
- Author:
- Mark Paluch, Christoph Strobl, John Blum
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.redis.connection.RedisConfiguration
RedisConfiguration.ClusterConfiguration, RedisConfiguration.DomainSocketConfiguration, RedisConfiguration.SentinelConfiguration, RedisConfiguration.StaticMasterReplicaConfiguration, RedisConfiguration.WithAuthentication, RedisConfiguration.WithDatabaseIndex, RedisConfiguration.WithDomainSocket, RedisConfiguration.WithHostAndPort, RedisConfiguration.WithPassword -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new defaultRedisStandaloneConfiguration.RedisStandaloneConfiguration(String hostName) Create a newRedisStandaloneConfigurationgivenhostName.RedisStandaloneConfiguration(String hostName, int port) -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGet the database index to use.Get the RedisPassword to use when connecting.intgetPort()Get the Redis server port.Get the username to use when connecting.inthashCode()voidsetDatabase(int index) Set the database index to use.voidsetHostName(String hostName) Set the Redis server hostnamevoidsetPassword(RedisPassword password) Create and set aRedisPasswordfor givenString.voidsetPort(int port) Set the Redis server port.voidsetUsername(String username) Create and set a username with the givenString.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.redis.connection.RedisConfiguration
getDatabaseOrElse, getPasswordOrElseMethods inherited from interface org.springframework.data.redis.connection.RedisConfiguration.WithAuthentication
setPassword, setPassword
-
Constructor Details
-
RedisStandaloneConfiguration
public RedisStandaloneConfiguration()Create a new defaultRedisStandaloneConfiguration. -
RedisStandaloneConfiguration
Create a newRedisStandaloneConfigurationgivenhostName.- Parameters:
hostName- must not be null or empty.
-
RedisStandaloneConfiguration
- Parameters:
hostName- must not be null or empty.port- a valid TCP port (1-65535).
-
-
Method Details
-
getHostName
- Specified by:
getHostNamein interfaceRedisConfiguration.WithHostAndPort- Returns:
- never null.
-
getPort
public int getPort()Description copied from interface:RedisConfiguration.WithHostAndPortGet the Redis server port.- Specified by:
getPortin interfaceRedisConfiguration.WithHostAndPort- Returns:
-
setHostName
Description copied from interface:RedisConfiguration.WithHostAndPortSet the Redis server hostname- Specified by:
setHostNamein interfaceRedisConfiguration.WithHostAndPort- Parameters:
hostName- must not be null.
-
setPort
public void setPort(int port) Description copied from interface:RedisConfiguration.WithHostAndPortSet the Redis server port.- Specified by:
setPortin interfaceRedisConfiguration.WithHostAndPort
-
getDatabase
public int getDatabase()Description copied from interface:RedisConfiguration.WithDatabaseIndexGet the database index to use.- Specified by:
getDatabasein interfaceRedisConfiguration.WithDatabaseIndex- Returns:
zeroby default.
-
setDatabase
public void setDatabase(int index) Description copied from interface:RedisConfiguration.WithDatabaseIndexSet the database index to use.- Specified by:
setDatabasein interfaceRedisConfiguration.WithDatabaseIndex
-
setUsername
Description copied from interface:RedisConfiguration.WithAuthenticationCreate and set a username with the givenString. Requires Redis 6 or newer.- Specified by:
setUsernamein interfaceRedisConfiguration.WithAuthentication- Parameters:
username- the username.
-
getUsername
Description copied from interface:RedisConfiguration.WithAuthenticationGet the username to use when connecting.- Specified by:
getUsernamein interfaceRedisConfiguration.WithAuthentication- Returns:
- null if none set.
-
getPassword
Description copied from interface:RedisConfiguration.WithAuthenticationGet the RedisPassword to use when connecting.- Specified by:
getPasswordin interfaceRedisConfiguration.WithAuthentication- Returns:
RedisPassword.none()if none set.
-
setPassword
Description copied from interface:RedisConfiguration.WithAuthenticationCreate and set aRedisPasswordfor givenString.- Specified by:
setPasswordin interfaceRedisConfiguration.WithAuthentication- Parameters:
password- must not be null useRedisPassword.none()instead.
-
equals
-
hashCode
public int hashCode()
-