Class LettuceConnectionFactory

java.lang.Object
org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory
All Implemented Interfaces:
DisposableBean, InitializingBean, PersistenceExceptionTranslator, ReactiveRedisConnectionFactory, RedisConnectionFactory

public class LettuceConnectionFactory extends Object implements InitializingBean, DisposableBean, RedisConnectionFactory, ReactiveRedisConnectionFactory
Connection factory creating Lettuce-based connections.

This factory creates a new LettuceConnection on each call to getConnection(). Multiple LettuceConnections share a single thread-safe native connection by default.

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:

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