| Modifier and Type | Method and Description |
|---|---|
RedisURI |
build()
Builds a new
RedisURI. |
static RedisURI.Builder |
redis(String host)
Set Redis host.
|
static RedisURI.Builder |
redis(String host,
int port)
Set Redis host and port.
|
static RedisURI.Builder |
sentinel(String host)
Set Sentinel host.
|
static RedisURI.Builder |
sentinel(String host,
int port)
Set Sentinel host and port.
|
static RedisURI.Builder |
sentinel(String host,
int port,
String masterId)
Set Sentinel host, port and master id.
|
static RedisURI.Builder |
sentinel(String host,
int port,
String masterId,
CharSequence password)
Set Sentinel host, port, master id and Sentinel authentication.
|
static RedisURI.Builder |
sentinel(String host,
String masterId)
Set Sentinel host and master id.
|
static RedisURI.Builder |
socket(String socket)
Set Redis socket.
|
RedisURI.Builder |
withAuthentication(RedisCredentialsProvider credentialsProvider)
Configures authentication.
|
RedisURI.Builder |
withAuthentication(RedisURI source)
Apply authentication from another
RedisURI. |
RedisURI.Builder |
withAuthentication(String username,
char[] password)
Configures authentication.
|
RedisURI.Builder |
withAuthentication(String username,
CharSequence password)
Configures authentication.
|
RedisURI.Builder |
withClientName(String clientName)
Configures a client name.
|
RedisURI.Builder |
withDatabase(int database)
Configures the database number.
|
RedisURI.Builder |
withDriverInfo(DriverInfo driverInfo)
Configures driver information containing the library name and upstream drivers.
|
RedisURI.Builder |
withHost(String host)
Adds host information to the builder.
|
RedisURI.Builder |
withLibraryName(String libraryName)
Configures a library name.
|
RedisURI.Builder |
withLibraryVersion(String libraryVersion)
Configures a library version.
|
RedisURI.Builder |
withPassword(char[] password)
Configures authentication.
|
RedisURI.Builder |
withPassword(CharSequence password)
Configures authentication.
|
RedisURI.Builder |
withPort(int port)
Adds port information to the builder.
|
RedisURI.Builder |
withSentinel(RedisURI redisURI)
Add a withSentinel RedisURI to the existing builder.
|
RedisURI.Builder |
withSentinel(String host)
Add a withSentinel host to the existing builder.
|
RedisURI.Builder |
withSentinel(String host,
int port)
Add a withSentinel host/port to the existing builder.
|
RedisURI.Builder |
withSentinel(String host,
int port,
CharSequence password)
Add a withSentinel host/port and Sentinel authentication to the existing builder.
|
RedisURI.Builder |
withSentinelMasterId(String sentinelMasterId)
Configures a sentinel master Id.
|
RedisURI.Builder |
withSsl(boolean ssl)
Adds ssl information to the builder.
|
RedisURI.Builder |
withSsl(RedisURI source)
Apply authentication from another
RedisURI. |
RedisURI.Builder |
withStartTls(boolean startTls)
Enables/disables StartTLS when using SSL.
|
RedisURI.Builder |
withTimeout(Duration timeout)
Configures a timeout.
|
RedisURI.Builder |
withVerifyPeer(boolean verifyPeer)
Enables/disables peer verification.
|
RedisURI.Builder |
withVerifyPeer(SslVerifyMode verifyMode)
Configures peer verification mode.
|
public static RedisURI.Builder socket(String socket)
socket - the host namepublic static RedisURI.Builder redis(String host)
host - the host namepublic static RedisURI.Builder redis(String host, int port)
host - the host nameport - the portpublic static RedisURI.Builder sentinel(String host)
host - the host namepublic static RedisURI.Builder sentinel(String host, int port)
host - the host nameport - the portpublic static RedisURI.Builder sentinel(String host, String masterId)
host - the host namemasterId - sentinel master idpublic static RedisURI.Builder sentinel(String host, int port, String masterId)
host - the host nameport - the portmasterId - sentinel master idpublic static RedisURI.Builder sentinel(String host, int port, String masterId, CharSequence password)
host - the host nameport - the portmasterId - sentinel master idpassword - the Sentinel password (supported since Redis 5.0.1)public RedisURI.Builder withSentinel(String host)
host - the host namepublic RedisURI.Builder withSentinel(String host, int port)
host - the host nameport - the portpublic RedisURI.Builder withSentinel(String host, int port, CharSequence password)
host - the host nameport - the portpassword - the Sentinel password (supported since Redis 5.0.1)public RedisURI.Builder withSentinel(RedisURI redisURI)
redisURI - the sentinel URIpublic RedisURI.Builder withHost(String host)
host - the portpublic RedisURI.Builder withPort(int port)
port - the portpublic RedisURI.Builder withSsl(RedisURI source)
RedisURI. The SSL settings of the source URI will be applied to
this URI. That is in particular SSL usage, peer verification and StartTLS.source - must not be null.public RedisURI.Builder withSsl(boolean ssl)
ssl - true if use SSLpublic RedisURI.Builder withStartTls(boolean startTls)
startTls - true if use StartTLSpublic RedisURI.Builder withVerifyPeer(boolean verifyPeer)
verifyPeer - true to verify hosts when using SSLpublic RedisURI.Builder withVerifyPeer(SslVerifyMode verifyMode)
verifyMode - the mode to verify hosts when using SSLpublic RedisURI.Builder withDatabase(int database)
database - the database numberpublic RedisURI.Builder withClientName(String clientName)
clientName - the client namepublic RedisURI.Builder withLibraryName(String libraryName)
libraryName - the library namepublic RedisURI.Builder withDriverInfo(DriverInfo driverInfo)
This method allows upstream libraries (e.g., Spring Data Redis) that use Lettuce as their Redis driver to identify
themselves. The driver information is sent via the CLIENT SETINFO command.
If both withLibraryName(String) and this method are called, the last call wins. When driverInfo is
set, it takes precedence over libraryName in the built RedisURI.
Also sets driver info for already configured Redis Sentinel nodes.
driverInfo - the driver information, must not be nullIllegalArgumentException - if driverInfo is nullDriverInfo,
CLIENT SETINFOpublic RedisURI.Builder withLibraryVersion(String libraryVersion)
libraryVersion - the library versionpublic RedisURI.Builder withAuthentication(String username, CharSequence password)
username - the user namepassword - the password namepublic RedisURI.Builder withAuthentication(RedisURI source)
RedisURI. The authentication settings of the source URI will be
applied to this builder.source - must not be null.public RedisURI.Builder withAuthentication(String username, char[] password)
username - the user namepassword - the password namepublic RedisURI.Builder withAuthentication(RedisCredentialsProvider credentialsProvider)
credentialsProvider - the credentials provider to usepublic RedisURI.Builder withPassword(CharSequence password)
password - the passwordpublic RedisURI.Builder withPassword(char[] password)
password - the passwordpublic RedisURI.Builder withTimeout(Duration timeout)
timeout - must not be null or negative.public RedisURI.Builder withSentinelMasterId(String sentinelMasterId)
sentinelMasterId - sentinel master id, must not be empty or nullCopyright © 2026 lettuce.io. All rights reserved.