@Experimental public class ImmutableRedisURI extends RedisURI
RedisURI that prevents any modifications after construction. All setter methods throw
UnsupportedOperationException.RedisURI.BuilderCONVERTER_MAP, DEFAULT_REDIS_PORT, DEFAULT_SENTINEL_PORT, DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_DURATION, PARAMETER_NAME_CLIENT_NAME, PARAMETER_NAME_DATABASE, PARAMETER_NAME_DATABASE_ALT, PARAMETER_NAME_LIBRARY_NAME, PARAMETER_NAME_LIBRARY_VERSION, PARAMETER_NAME_SENTINEL_MASTER_ID, PARAMETER_NAME_TIMEOUT, PARAMETER_NAME_VERIFY_PEER, URI_SCHEME_REDIS, URI_SCHEME_REDIS_SECURE, URI_SCHEME_REDIS_SECURE_ALT, URI_SCHEME_REDIS_SENTINEL, URI_SCHEME_REDIS_SENTINEL_SECURE, URI_SCHEME_REDIS_SOCKET, URI_SCHEME_REDIS_SOCKET_ALT, URI_SCHEME_REDIS_TLS_ALT| Constructor and Description |
|---|
ImmutableRedisURI(RedisURI redisURI) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyAuthentication(RedisURI source)
Apply authentication from another
RedisURI. |
void |
applySsl(RedisURI source)
Apply authentication from another
RedisURI. |
List<RedisURI> |
getSentinels() |
void |
setAuthentication(char[] password)
Sets the password to use to authenticate Redis connections.
|
void |
setAuthentication(CharSequence password)
Sets the password to use to authenticate Redis connections.
|
void |
setAuthentication(String username,
char[] password)
Sets the username and password to use to authenticate Redis connections.
|
void |
setAuthentication(String username,
CharSequence password)
Sets the username and password to use to authenticate Redis connections.
|
void |
setClientName(String clientName)
Sets the client name to be applied on Redis connections.
|
void |
setCredentialsProvider(RedisCredentialsProvider credentialsProvider)
Sets the
RedisCredentialsProvider. |
void |
setDatabase(int database)
Sets the Redis database number.
|
void |
setDriverInfo(DriverInfo driverInfo)
Sets the driver information containing the library name and upstream drivers.
|
void |
setHost(String host)
Sets the Redis host.
|
void |
setLibraryName(String libraryName)
Sets the library name to be applied on Redis connections.
|
void |
setLibraryVersion(String libraryVersion)
Sets the library version to be applied on Redis connections.
|
void |
setPort(int port)
Sets the Redis port.
|
void |
setSentinelMasterId(String sentinelMasterId)
Sets the Sentinel Master Id.
|
void |
setSocket(String socket)
Sets the Unix Domain Socket path.
|
void |
setSsl(boolean ssl)
Sets whether to use SSL.
|
void |
setStartTls(boolean startTls)
Returns whether StartTLS is enabled.
|
void |
setTimeout(Duration timeout)
Sets the command timeout for synchronous command execution.
|
void |
setVerifyPeer(boolean verifyPeer)
Sets whether to verify peers when using
SSL. |
void |
setVerifyPeer(SslVerifyMode verifyMode)
Sets how to verify peers when using
SSL. |
builder, builder, create, create, create, equals, getClientName, getCredentialsProvider, getDatabase, getDriverInfo, getHost, getLibraryName, getLibraryVersion, getPort, getSentinelMasterId, getSocket, getTimeout, getVerifyMode, hashCode, isSsl, isStartTls, isVerifyPeer, toString, toURIpublic ImmutableRedisURI(RedisURI redisURI)
public void setHost(String host)
RedisURIpublic void setSentinelMasterId(String sentinelMasterId)
RedisURIsetSentinelMasterId in class RedisURIsentinelMasterId - the Sentinel Master Id.public void setPort(int port)
RedisURIRedisURI.DEFAULT_REDIS_PORT.public void setSocket(String socket)
RedisURIpublic void applyAuthentication(RedisURI source)
RedisURIRedisURI. The authentication settings of the source URI will be applied
to this URI. That is in particular the RedisCredentialsProvider.applyAuthentication in class RedisURIsource - must not be null.public void setAuthentication(CharSequence password)
RedisURI
This method effectively overwrites any existing RedisCredentialsProvider with a new one, containing an empty
username and the provided password.
setAuthentication in class RedisURIpassword - the password to use to authenticate Redis connections.RedisURI.setCredentialsProvider(RedisCredentialsProvider)public void setAuthentication(char[] password)
RedisURI
This method effectively overwrites any existing RedisCredentialsProvider with a new one, containing an empty
username and the provided password.
setAuthentication in class RedisURIpassword - the password to use to authenticate Redis connections.RedisURI.setCredentialsProvider(RedisCredentialsProvider)public void setAuthentication(String username, char[] password)
RedisURI
This method effectively overwrites any existing RedisCredentialsProvider with a new one, containing the provided
username and password.
setAuthentication in class RedisURIusername - the username to use to authenticate Redis connections.password - the password to use to authenticate Redis connections.RedisURI.setCredentialsProvider(RedisCredentialsProvider)public void setAuthentication(String username, CharSequence password)
RedisURI
This method effectively overwrites any existing RedisCredentialsProvider with a new one, containing the provided
username and password.
setAuthentication in class RedisURIusername - the username to use to authenticate Redis connections.password - the password to use to authenticate Redis connections.RedisURI.setCredentialsProvider(RedisCredentialsProvider)public void setCredentialsProvider(RedisCredentialsProvider credentialsProvider)
RedisURIRedisCredentialsProvider. Configuring a credentials provider resets the configured static
username/password.setCredentialsProvider in class RedisURIcredentialsProvider - the credentials provider to use when authenticating a Redis connection.public void setTimeout(Duration timeout)
RedisURIsetTimeout in class RedisURItimeout - the command timeout for synchronous command execution.public void setDatabase(int database)
RedisURIsetDatabase in class RedisURIdatabase - the Redis database number.public void setClientName(String clientName)
RedisURIsetClientName in class RedisURIclientName - the client name.public void setLibraryName(String libraryName)
RedisURI
This method creates a new DriverInfo with only the specified name, clearing any previously set upstream drivers.
If you want to preserve upstream drivers, use RedisURI.setDriverInfo(DriverInfo) instead.
setLibraryName in class RedisURIlibraryName - the library name, must not contain spaces.RedisURI.setDriverInfo(DriverInfo)public void setDriverInfo(DriverInfo driverInfo)
RedisURI
This method replaces any previously set driver information or library name. Use this method when you want structured
control over the library identification sent via CLIENT SETINFO.
setDriverInfo in class RedisURIdriverInfo - the driver information to setDriverInfo,
RedisURI.setLibraryName(String)public void setLibraryVersion(String libraryVersion)
RedisURIsetLibraryVersion in class RedisURIlibraryVersion - the library version.public void applySsl(RedisURI source)
RedisURIRedisURI. The SSL settings of the source URI will be applied to this
URI. That is in particular SSL usage, peer verification and StartTLS.public void setSsl(boolean ssl)
RedisURIpublic void setVerifyPeer(boolean verifyPeer)
RedisURISSL. Sets peer verification also for already configured Redis
Sentinel nodes.setVerifyPeer in class RedisURIverifyPeer - true to verify peers when using SSL.public void setVerifyPeer(SslVerifyMode verifyMode)
RedisURISSL. Sets peer verification also for already configured Redis
Sentinel nodes.setVerifyPeer in class RedisURIverifyMode - verification mode to use when using SSL.public void setStartTls(boolean startTls)
RedisURIsetStartTls in class RedisURIstartTls - true if StartTLS is enabled.public List<RedisURI> getSentinels()
getSentinels in class RedisURIRedis Sentinel URIs.Copyright © 2026 lettuce.io. All rights reserved.