Class LettuceConnectionFactory
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.dao.support.PersistenceExceptionTranslator
,ReactiveRedisConnectionFactory
,RedisConnectionFactory
This factory creates a new LettuceConnection
on each call to getConnection()
. While multiple
LettuceConnection
s share a single thread-safe native connection by default, LettuceConnection
and its
clustered variant
are not Thread-safe and instances should not be shared across
threads.
The shared native connection is never closed by LettuceConnection
, therefore it is not validated by default
on getConnection()
. Use setValidateConnection(boolean)
to change this behavior if necessary. If
shareNativeConnection
is true, a shared connection will be used for regular operations and a
LettuceConnectionProvider
will be used to select a connection for blocking and tx operations only, which
should not share a connection. If native connection sharing is disabled, new (or pooled) connections will be used for
all operations.
LettuceConnectionFactory
should be configured using an environmental configuration and the
client configuration
. Lettuce supports the following environmental configurations:
RedisStandaloneConfiguration
RedisStaticMasterReplicaConfiguration
RedisSocketConfiguration
RedisSentinelConfiguration
RedisClusterConfiguration
This connection factory must be initialized
prior to obtaining
connections
.
- Author:
- Costin Leau, Jennifer Hickey, Thomas Darimont, Christoph Strobl, Mark Paluch, Balázs Németh, Ruben Cervilla, Luis De Bello, Andrea Como, Chris Bono
-
Constructor Summary
ConstructorDescriptionConstructs a newLettuceConnectionFactory
instance with default settings.LettuceConnectionFactory
(String host, int port) Constructs a newLettuceConnectionFactory
instance with default settings.LettuceConnectionFactory
(RedisClusterConfiguration clusterConfiguration) Constructs a newLettuceConnectionFactory
instance using the givenRedisClusterConfiguration
applied to create aRedisClusterClient
.LettuceConnectionFactory
(RedisClusterConfiguration clusterConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisClusterConfiguration
andLettuceClientConfiguration
.LettuceConnectionFactory
(RedisConfiguration redisConfiguration) Constructs a newLettuceConnectionFactory
instance using the givenRedisSocketConfiguration
.LettuceConnectionFactory
(RedisConfiguration redisConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisStaticMasterReplicaConfiguration
andLettuceClientConfiguration
.LettuceConnectionFactory
(RedisSentinelConfiguration sentinelConfiguration) Constructs a newLettuceConnectionFactory
instance using the givenRedisSentinelConfiguration
.LettuceConnectionFactory
(RedisSentinelConfiguration sentinelConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisSentinelConfiguration
andLettuceClientConfiguration
.LettuceConnectionFactory
(RedisStandaloneConfiguration configuration) Constructs a newLettuceConnectionFactory
instance with default settings.LettuceConnectionFactory
(RedisStandaloneConfiguration standaloneConfig, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisStandaloneConfiguration
andLettuceClientConfiguration
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected io.lettuce.core.AbstractRedisClient
static RedisConfiguration
createRedisConfiguration
(io.lettuce.core.RedisURI redisUri) Creates aRedisConfiguration
based on aRedisURI
according to the following: IfRedisURI
contains sentinels, aRedisSentinelConfiguration
is returned IfRedisURI
has a configured socket aRedisSocketConfiguration
is returned Otherwise aRedisStandaloneConfiguration
is returnedstatic RedisConfiguration
createRedisConfiguration
(String redisUri) Creates aRedisConfiguration
based on aURI
according to the following: IfredisUri
contains sentinels, aRedisSentinelConfiguration
is returned IfredisUri
has a configured socket aRedisSocketConfiguration
is returned Otherwise aRedisStandaloneConfiguration
is returnedvoid
destroy()
protected LettuceConnectionProvider
doCreateConnectionProvider
(io.lettuce.core.AbstractRedisClient client, io.lettuce.core.codec.RedisCodec<?, ?> codec) protected LettuceClusterConnection
doCreateLettuceClusterConnection
(io.lettuce.core.cluster.api.StatefulRedisClusterConnection<byte[], byte[]> sharedConnection, LettuceConnectionProvider connectionProvider, ClusterTopologyProvider topologyProvider, ClusterCommandExecutor clusterCommandExecutor, Duration commandTimeout) Customization hook forLettuceClusterConnection
creation.protected LettuceConnection
doCreateLettuceConnection
(io.lettuce.core.api.StatefulRedisConnection<byte[], byte[]> sharedConnection, LettuceConnectionProvider connectionProvider, long timeout, int database) Customization hook forLettuceConnection
creation.Returns the client name.io.lettuce.core.resource.ClientResources
Get theClientResources
to reuse infrastructure.Provides a suitable connection for interacting with Redis Cluster.Provides a suitable connection for interacting with Redis.boolean
Specifies if pipelined results should be converted to the expected data type.int
Returns the index of the database.boolean
Indicatesshared connections
should be eagerly initialized.Returns the current host.io.lettuce.core.AbstractRedisClient
Returns the nativeAbstractRedisClient
used by this instance.Returns the password used for authenticating with the Redis server.int
getPort()
Returns the current port.org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisClusterConnection
org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisConnection
io.lettuce.core.AbstractRedisClient
Returns the nativeAbstractRedisClient
used by this instance.Provides a suitable connection for interacting with Redis Sentinel.protected io.lettuce.core.cluster.api.StatefulRedisClusterConnection<byte[],
byte[]> protected io.lettuce.core.api.StatefulRedisConnection<byte[],
byte[]> protected io.lettuce.core.api.StatefulConnection<ByteBuffer,
ByteBuffer> boolean
Indicates if multipleLettuceConnection
s should share a single native connection.long
Returns the shutdown timeout for shutting down the RedisClient (in milliseconds).long
Returns the connection timeout (in milliseconds).boolean
Indicates if validation of the native Lettuce connection is enabled.void
Initialize the shared connection ifnative connection sharing
is enabled and reset any previously existing connection.boolean
boolean
boolean
Returns whether to issue a StartTLS.boolean
isUseSsl()
Returns whether to use SSL.boolean
Returns whether to verify certificate validity/hostname check when SSL is used.void
Reset the underlying shared Connection, to be reinitialized on next access.void
setClientName
(String clientName) Deprecated.void
setClientResources
(io.lettuce.core.resource.ClientResources clientResources) Deprecated.since 2.0, configureClientResources
usingLettuceClientConfiguration
.void
setConvertPipelineAndTxResults
(boolean convertPipelineAndTxResults) Specifies if pipelined and transaction results should be converted to the expected data type.void
setDatabase
(int index) Sets the index of the database used by this connection factory.void
setEagerInitialization
(boolean eagerInitialization) Enables eager initialization ofshared connections
.void
setHostName
(String hostName) Deprecated.since 2.0, configure the hostname usingRedisStandaloneConfiguration
.void
setPassword
(String password) Deprecated.since 2.0, configure the password usingRedisStandaloneConfiguration
,RedisSentinelConfiguration
orRedisClusterConfiguration
.void
setPipeliningFlushPolicy
(LettuceConnection.PipeliningFlushPolicy pipeliningFlushPolicy) Configures the flushing policy when using pipelining.void
setPort
(int port) Deprecated.since 2.0, configure the port usingRedisStandaloneConfiguration
.void
setShareNativeConnection
(boolean shareNativeConnection) Enables multipleLettuceConnection
s to share a single native connection.void
setShutdownTimeout
(long shutdownTimeout) Deprecated.since 2.0, configure the shutdown timeout usingLettuceClientConfiguration
.void
setStartTls
(boolean startTls) Deprecated.since 2.0, configure StartTLS usingLettuceClientConfiguration
.void
setTimeout
(long timeout) Deprecated.since 2.0, configure the timeout usingLettuceClientConfiguration
.void
setUseSsl
(boolean useSsl) Deprecated.since 2.0, configure SSL usage usingLettuceClientConfiguration
.void
setValidateConnection
(boolean validateConnection) Enables validation of the shared native Lettuce connection on calls togetConnection()
.void
setVerifyPeer
(boolean verifyPeer) Deprecated.since 2.0, configure peer verification usingLettuceClientConfiguration
.org.springframework.dao.DataAccessException
void
Validate the shared connections and reinitialize if invalid.
-
Constructor Details
-
LettuceConnectionFactory
public LettuceConnectionFactory()Constructs a newLettuceConnectionFactory
instance with default settings. -
LettuceConnectionFactory
Constructs a newLettuceConnectionFactory
instance with default settings. -
LettuceConnectionFactory
Constructs a newLettuceConnectionFactory
instance with default settings. -
LettuceConnectionFactory
Constructs a newLettuceConnectionFactory
instance using the givenRedisSocketConfiguration
.- Parameters:
redisConfiguration
- must not be null.- Since:
- 2.1
-
LettuceConnectionFactory
Constructs a newLettuceConnectionFactory
instance using the givenRedisSentinelConfiguration
.- Parameters:
sentinelConfiguration
- must not be null.- Since:
- 1.6
-
LettuceConnectionFactory
Constructs a newLettuceConnectionFactory
instance using the givenRedisClusterConfiguration
applied to create aRedisClusterClient
.- Parameters:
clusterConfiguration
- must not be null.- Since:
- 1.7
-
LettuceConnectionFactory
public LettuceConnectionFactory(RedisStandaloneConfiguration standaloneConfig, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisStandaloneConfiguration
andLettuceClientConfiguration
.- Parameters:
standaloneConfig
- must not be null.clientConfig
- must not be null.- Since:
- 2.0
-
LettuceConnectionFactory
public LettuceConnectionFactory(RedisConfiguration redisConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisStaticMasterReplicaConfiguration
andLettuceClientConfiguration
.- Parameters:
redisConfiguration
- must not be null.clientConfig
- must not be null.- Since:
- 2.1
-
LettuceConnectionFactory
public LettuceConnectionFactory(RedisSentinelConfiguration sentinelConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisSentinelConfiguration
andLettuceClientConfiguration
.- Parameters:
sentinelConfiguration
- must not be null.clientConfig
- must not be null.- Since:
- 2.0
-
LettuceConnectionFactory
public LettuceConnectionFactory(RedisClusterConfiguration clusterConfiguration, LettuceClientConfiguration clientConfig) Constructs a newLettuceConnectionFactory
instance using the givenRedisClusterConfiguration
andLettuceClientConfiguration
.- Parameters:
clusterConfiguration
- must not be null.clientConfig
- must not be null.- Since:
- 2.0
-
-
Method Details
-
createRedisConfiguration
Creates aRedisConfiguration
based on aURI
according to the following:- If
redisUri
contains sentinels, aRedisSentinelConfiguration
is returned - If
redisUri
has a configured socket aRedisSocketConfiguration
is returned - Otherwise a
RedisStandaloneConfiguration
is returned
- Parameters:
redisUri
- the connection URI in the format of aRedisURI
.- Returns:
- an appropriate
RedisConfiguration
instance representing the Redis URI. - Since:
- 2.5.3
- See Also:
-
RedisURI
- If
-
createRedisConfiguration
Creates aRedisConfiguration
based on aRedisURI
according to the following:- If
RedisURI
contains sentinels, aRedisSentinelConfiguration
is returned - If
RedisURI
has a configured socket aRedisSocketConfiguration
is returned - Otherwise a
RedisStandaloneConfiguration
is returned
- Parameters:
redisUri
- the connection URI.- Returns:
- an appropriate
RedisConfiguration
instance representing the Redis URI. - Since:
- 2.5.3
- See Also:
-
RedisURI
- If
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
destroy
public void destroy()- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
-
getConnection
Description copied from interface:RedisConnectionFactory
Provides a suitable connection for interacting with Redis.- Specified by:
getConnection
in interfaceRedisConnectionFactory
- Returns:
- connection for interacting with Redis.
-
getClusterConnection
Description copied from interface:RedisConnectionFactory
Provides a suitable connection for interacting with Redis Cluster.- Specified by:
getClusterConnection
in interfaceRedisConnectionFactory
- Returns:
-
doCreateLettuceConnection
protected LettuceConnection doCreateLettuceConnection(@Nullable io.lettuce.core.api.StatefulRedisConnection<byte[], byte[]> sharedConnection, LettuceConnectionProvider connectionProvider, long timeout, int database) Customization hook forLettuceConnection
creation.- Parameters:
sharedConnection
- the sharedStatefulRedisConnection
ifgetShareNativeConnection()
is true; null otherwise.connectionProvider
- theLettuceConnectionProvider
to release connections.timeout
- command timeout inTimeUnit.MILLISECONDS
.database
- database index to operate on.- Returns:
- the
LettuceConnection
. - Throws:
IllegalArgumentException
- if a required parameter is null.- Since:
- 2.2
-
doCreateLettuceClusterConnection
protected LettuceClusterConnection doCreateLettuceClusterConnection(@Nullable io.lettuce.core.cluster.api.StatefulRedisClusterConnection<byte[], byte[]> sharedConnection, LettuceConnectionProvider connectionProvider, ClusterTopologyProvider topologyProvider, ClusterCommandExecutor clusterCommandExecutor, Duration commandTimeout) Customization hook forLettuceClusterConnection
creation.- Parameters:
sharedConnection
- the sharedStatefulRedisConnection
ifgetShareNativeConnection()
is true; null otherwise.connectionProvider
- theLettuceConnectionProvider
to release connections.topologyProvider
- theClusterTopologyProvider
.clusterCommandExecutor
- theClusterCommandExecutor
to release connections.commandTimeout
- command timeoutDuration
.- Returns:
- the
LettuceConnection
. - Throws:
IllegalArgumentException
- if a required parameter is null.- Since:
- 2.2
-
getReactiveConnection
public org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisConnection getReactiveConnection()- Specified by:
getReactiveConnection
in interfaceReactiveRedisConnectionFactory
- Returns:
- a reactive Redis connection.
-
getReactiveClusterConnection
public org.springframework.data.redis.connection.lettuce.LettuceReactiveRedisClusterConnection getReactiveClusterConnection()- Specified by:
getReactiveClusterConnection
in interfaceReactiveRedisConnectionFactory
- Returns:
- a reactive Redis Cluster connection.
-
initConnection
public void initConnection()Initialize the shared connection ifnative connection sharing
is enabled and reset any previously existing connection. -
resetConnection
public void resetConnection()Reset the underlying shared Connection, to be reinitialized on next access. -
validateConnection
public void validateConnection()Validate the shared connections and reinitialize if invalid. -
translateExceptionIfPossible
public org.springframework.dao.DataAccessException translateExceptionIfPossible(RuntimeException ex) - Specified by:
translateExceptionIfPossible
in interfaceorg.springframework.dao.support.PersistenceExceptionTranslator
-
getHostName
Returns the current host.- Returns:
- the host.
-
setHostName
Deprecated.since 2.0, configure the hostname usingRedisStandaloneConfiguration
.Sets the hostname.- Parameters:
hostName
- the hostname to set.
-
getPort
public int getPort()Returns the current port.- Returns:
- the port.
-
setPort
Deprecated.since 2.0, configure the port usingRedisStandaloneConfiguration
.Sets the port.- Parameters:
port
- the port to set.
-
setPipeliningFlushPolicy
Configures the flushing policy when using pipelining. If not set, defaults toflush on each command
.- Parameters:
pipeliningFlushPolicy
- the flushing policy to control when commands get written to the Redis connection.- Since:
- 2.3
- See Also:
-
LettuceConnection.openPipeline()
StatefulConnection.flushCommands()
-
getTimeout
public long getTimeout()Returns the connection timeout (in milliseconds).- Returns:
- connection timeout.
-
setTimeout
Deprecated.since 2.0, configure the timeout usingLettuceClientConfiguration
.Sets the connection timeout (in milliseconds).- Parameters:
timeout
- the timeout.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.
-
isUseSsl
public boolean isUseSsl()Returns whether to use SSL.- Returns:
- use of SSL.
-
setUseSsl
Deprecated.since 2.0, configure SSL usage usingLettuceClientConfiguration
.Sets to use SSL connection.- Parameters:
useSsl
- true to use SSL.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.
-
isVerifyPeer
public boolean isVerifyPeer()Returns whether to verify certificate validity/hostname check when SSL is used.- Returns:
- whether to verify peers when using SSL.
-
setVerifyPeer
Deprecated.since 2.0, configure peer verification usingLettuceClientConfiguration
.Sets to use verify certificate validity/hostname check when SSL is used.- Parameters:
verifyPeer
- false not to verify hostname.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.
-
isStartTls
public boolean isStartTls()Returns whether to issue a StartTLS.- Returns:
- use of StartTLS.
-
setStartTls
Deprecated.since 2.0, configure StartTLS usingLettuceClientConfiguration
.Sets to issue StartTLS.- Parameters:
startTls
- true to issue StartTLS.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.
-
getValidateConnection
public boolean getValidateConnection()Indicates if validation of the native Lettuce connection is enabled.- Returns:
- connection validation enabled.
-
setValidateConnection
public void setValidateConnection(boolean validateConnection) Enables validation of the shared native Lettuce connection on calls togetConnection()
. A new connection will be created and used if validation fails.Lettuce will automatically reconnect until close is called, which should never happen through
LettuceConnection
if a shared native connection is used, therefore the default is false.Setting this to true will result in a round-trip call to the server on each new connection, so this setting should only be used if connection sharing is enabled and there is code that is actively closing the native Lettuce connection.
- Parameters:
validateConnection
- enable connection validation.
-
getEagerInitialization
public boolean getEagerInitialization()Indicatesshared connections
should be eagerly initialized. Eager initialization requires a running Redis instance during application startup to allow early validation of connection factory configuration. Eager initialization also prevents blocking connect while using reactive API and is recommended for reactive API usage.- Returns:
- {@link true} if the shared connection is initialized upon
afterPropertiesSet()
. - Since:
- 2.2
-
setEagerInitialization
public void setEagerInitialization(boolean eagerInitialization) Enables eager initialization ofshared connections
.- Parameters:
eagerInitialization
- enable eager connection shared connection initialization uponafterPropertiesSet()
.- Since:
- 2.2
-
getDatabase
public int getDatabase()Returns the index of the database.- Returns:
- the database index.
-
setDatabase
public void setDatabase(int index) Sets the index of the database used by this connection factory. Default is 0.- Parameters:
index
- database index
-
getClientName
Returns the client name.- Returns:
- the client name or null if not set.
- Since:
- 2.1
-
setClientName
Deprecated.configure the client name usingLettuceClientConfiguration
.Sets the client name used by this connection factory.- Parameters:
clientName
- the client name. Can be null.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.- Since:
- 2.1
-
getNativeClient
@Nullable public io.lettuce.core.AbstractRedisClient getNativeClient()Returns the nativeAbstractRedisClient
used by this instance. The client is initialized as part ofthe bean initialization lifecycle
and only available when this connection factory is initialized.Depending on the configuration, the client can be either
RedisClient
orRedisClusterClient
.- Returns:
- the native
AbstractRedisClient
. Can be null if not initialized. - Since:
- 2.5
- See Also:
-
getRequiredNativeClient
public io.lettuce.core.AbstractRedisClient getRequiredNativeClient()Returns the nativeAbstractRedisClient
used by this instance. The client is initialized as part ofthe bean initialization lifecycle
and only available when this connection factory is initialized. ThrowsIllegalStateException
if not yet initialized.Depending on the configuration, the client can be either
RedisClient
orRedisClusterClient
.- Returns:
- the native
AbstractRedisClient
. - Throws:
IllegalStateException
- if not yet initialized.- Since:
- 2.5
- See Also:
-
getPassword
Returns the password used for authenticating with the Redis server.- Returns:
- password for authentication or null if not set.
-
setPassword
Deprecated.since 2.0, configure the password usingRedisStandaloneConfiguration
,RedisSentinelConfiguration
orRedisClusterConfiguration
.Sets the password used for authenticating with the Redis server.- Parameters:
password
- the password to set
-
getShutdownTimeout
public long getShutdownTimeout()Returns the shutdown timeout for shutting down the RedisClient (in milliseconds).- Returns:
- shutdown timeout.
- Since:
- 1.6
-
setShutdownTimeout
Deprecated.since 2.0, configure the shutdown timeout usingLettuceClientConfiguration
.Sets the shutdown timeout for shutting down the RedisClient (in milliseconds).- Parameters:
shutdownTimeout
- the shutdown timeout.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.- Since:
- 1.6
-
getClientResources
public io.lettuce.core.resource.ClientResources getClientResources()Get theClientResources
to reuse infrastructure.- Returns:
- null if not set.
- Since:
- 1.7
-
setClientResources
@Deprecated public void setClientResources(io.lettuce.core.resource.ClientResources clientResources) Deprecated.since 2.0, configureClientResources
usingLettuceClientConfiguration
.Sets theClientResources
to reuse the client infrastructure.
Set to null to not share resources.- Parameters:
clientResources
- can be null.- Throws:
IllegalStateException
- ifLettuceClientConfiguration
is immutable.- Since:
- 1.7
-
getClientConfiguration
- Returns:
- the
LettuceClientConfiguration
. - Since:
- 2.0
-
getStandaloneConfiguration
- Returns:
- the
RedisStandaloneConfiguration
. - Since:
- 2.0
-
getSocketConfiguration
- Returns:
- the
RedisSocketConfiguration
or null if not set. - Since:
- 2.1
-
getSentinelConfiguration
- Returns:
- the
RedisSentinelConfiguration
, may be null. - Since:
- 2.0
-
getClusterConfiguration
- Returns:
- the
RedisClusterConfiguration
, may be null. - Since:
- 2.0
-
getConvertPipelineAndTxResults
public boolean getConvertPipelineAndTxResults()Specifies if pipelined results should be converted to the expected data type. If false, results ofLettuceConnection.closePipeline()
and {LettuceConnection#exec()} will be of the type returned by the Lettuce driver.- Specified by:
getConvertPipelineAndTxResults
in interfaceRedisConnectionFactory
- Returns:
- Whether or not to convert pipeline and tx results.
-
setConvertPipelineAndTxResults
public void setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults) Specifies if pipelined and transaction results should be converted to the expected data type. If false, results ofLettuceConnection.closePipeline()
and {LettuceConnection#exec()} will be of the type returned by the Lettuce driver.- Parameters:
convertPipelineAndTxResults
- Whether or not to convert pipeline and tx results.
-
isRedisSentinelAware
public boolean isRedisSentinelAware()- Returns:
- true when
RedisSentinelConfiguration
is present. - Since:
- 1.5
-
isClusterAware
public boolean isClusterAware()- Returns:
- true when
RedisClusterConfiguration
is present. - Since:
- 1.7
-
doCreateConnectionProvider
protected LettuceConnectionProvider doCreateConnectionProvider(io.lettuce.core.AbstractRedisClient client, io.lettuce.core.codec.RedisCodec<?, ?> codec) Create aLettuceConnectionProvider
givenAbstractRedisClient
andRedisCodec
. Configuration of this connection factory specifies the type of the created connection provider. This method creates either aLettuceConnectionProvider
for eitherRedisClient
orRedisClusterClient
. Subclasses may override this method to decorate the connection provider.- Parameters:
client
- eitherRedisClient
orRedisClusterClient
, must not be null.codec
- used for connection creation, must not be null. By default, abyte[]
codec. Reactive connections require aByteBuffer
codec.- Returns:
- the connection provider.
- Since:
- 2.1
-
createClient
protected io.lettuce.core.AbstractRedisClient createClient() -
getSentinelConnection
Description copied from interface:RedisConnectionFactory
Provides a suitable connection for interacting with Redis Sentinel.- Specified by:
getSentinelConnection
in interfaceRedisConnectionFactory
- Returns:
- connection for interacting with Redis Sentinel.
-
LettuceClientConfiguration
.