org.springframework.data.redis.connection.lettuce
Class LettuceConnectionFactory

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

public class LettuceConnectionFactory
extends Object
implements InitializingBean, DisposableBean, RedisConnectionFactory

Connection factory creating Lettuce-based connections.


Constructor Summary
LettuceConnectionFactory()
          Constructs a new LettuceConnectionFactory instance with default settings.
LettuceConnectionFactory(String host, int port)
          Constructs a new LettuceConnectionFactory instance with default settings.
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 RedisConnection getConnection()
          Provides a suitable connection for interacting with Redis.
 String getHostName()
          Returns the current host.
 int getPort()
          Returns the current port.
 long getTimeout()
          Returns the connection timeout (in milliseconds).
 void setHostName(String host)
          Sets the host.
 void setPort(int port)
          Sets the port.
 void setTimeout(long timeout)
          Sets the connection timeout (in milliseconds).
 DataAccessException translateExceptionIfPossible(RuntimeException ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LettuceConnectionFactory

public LettuceConnectionFactory()
Constructs a new LettuceConnectionFactory instance with default settings.


LettuceConnectionFactory

public LettuceConnectionFactory(String host,
                                int port)
Constructs a new LettuceConnectionFactory instance with default settings.

Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

getConnection

public RedisConnection getConnection()
Description copied from interface: RedisConnectionFactory
Provides a suitable connection for interacting with Redis.

Specified by:
getConnection in interface RedisConnectionFactory
Returns:
connection for interacting with Redis.

translateExceptionIfPossible

public DataAccessException translateExceptionIfPossible(RuntimeException ex)
Specified by:
translateExceptionIfPossible in interface PersistenceExceptionTranslator

getHostName

public String getHostName()
Returns the current host.

Returns:
the host

setHostName

public void setHostName(String host)
Sets the host.

Parameters:
host - the host to set

getPort

public int getPort()
Returns the current port.

Returns:
the port

setPort

public void setPort(int port)
Sets the port.

Parameters:
port - the port to set

getTimeout

public long getTimeout()
Returns the connection timeout (in milliseconds).

Returns:
connection timeout

setTimeout

public void setTimeout(long timeout)
Sets the connection timeout (in milliseconds).

Parameters:
timeout - connection timeout