Class RedisSocketConfiguration
java.lang.Object
org.springframework.data.redis.connection.RedisSocketConfiguration
- All Implemented Interfaces:
RedisConfiguration,RedisConfiguration.DomainSocketConfiguration,RedisConfiguration.WithAuthentication,RedisConfiguration.WithDatabaseIndex,RedisConfiguration.WithDomainSocket,RedisConfiguration.WithPassword
public class RedisSocketConfiguration
extends Object
implements RedisConfiguration, RedisConfiguration.DomainSocketConfiguration
Configuration class used for setting up
RedisConnection via RedisConnectionFactory connecting to
single Redis using a local unix domain socket.- Since:
- 2.1
- Author:
- Mark Paluch, Christoph Strobl
-
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 defaultRedisSocketConfiguration.RedisSocketConfiguration(String socket) Create a newRedisSocketConfigurationgivensocket. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintGet the database index to use.Get the RedisPassword to use when connecting.Get the domain socket.Get the username to use when connecting.inthashCode()voidsetDatabase(int index) Set the database index to use.voidsetPassword(RedisPassword password) Create and set aRedisPasswordfor givenString.voidSet the socket.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
-
RedisSocketConfiguration
public RedisSocketConfiguration()Create a new defaultRedisSocketConfiguration. -
RedisSocketConfiguration
Create a newRedisSocketConfigurationgivensocket.- Parameters:
socket- must not be null or empty.
-
-
Method Details
-
getSocket
Description copied from interface:RedisConfiguration.WithDomainSocketGet the domain socket.- Specified by:
getSocketin interfaceRedisConfiguration.WithDomainSocket- Returns:
- path to the Redis socket.
-
setSocket
Description copied from interface:RedisConfiguration.WithDomainSocketSet the socket.- Specified by:
setSocketin interfaceRedisConfiguration.WithDomainSocket- Parameters:
socket- path to the Redis socket. Must not be null.
-
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()
-