Modifier and Type | Method and Description |
---|---|
RedisURI |
build() |
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)
Deprecated.
since 6.0, use
sentinel(String, int, String) and
withAuthentication(String, CharSequence) instead. |
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 |
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 |
withPassword(String password)
Deprecated.
since 6.0. Use
withPassword(CharSequence) or withPassword(char[]) to avoid String
caching. |
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 id@Deprecated public static RedisURI.Builder sentinel(String host, int port, String masterId, CharSequence password)
sentinel(String, int, String)
and
withAuthentication(String, CharSequence)
instead.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 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
- must not be null
.@Deprecated public RedisURI.Builder withPassword(String password)
withPassword(CharSequence)
or withPassword(char[])
to avoid String
caching.
This method is deprecated as of Lettuce 6.0. The reason is that String
has a strong caching affinity and the
JVM cannot easily GC String
instances. Therefore, we suggest using either char[]
or a custom
CharSequence
(e.g. StringBuilder
or netty's AsciiString
).
password
- the passwordpublic 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 null
public RedisURI build()
Copyright © 2023 lettuce.io. All rights reserved.