public class JredisConnectionFactory extends Object implements InitializingBean, DisposableBean, RedisConnectionFactory
Constructor and Description |
---|
JredisConnectionFactory()
Constructs a new
JredisConnectionFactory instance. |
JredisConnectionFactory(org.jredis.connector.ConnectionSpec connectionSpec)
Constructs a new
JredisConnectionFactory instance. |
JredisConnectionFactory(Pool<org.jredis.JRedis> pool) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
destroy() |
RedisConnection |
getConnection()
Provides a suitable connection for interacting with Redis.
|
boolean |
getConvertPipelineAndTxResults()
JredisConnection does not support pipeline or transactions |
int |
getDatabase()
Returns the index of the database.
|
String |
getHostName()
Returns the Redis host name of this factory.
|
String |
getPassword()
Returns the password used for authenticating with the Redis server.
|
int |
getPort()
Returns the Redis port.
|
RedisSentinelConnection |
getSentinelConnection() |
protected RedisConnection |
postProcessConnection(JredisConnection connection)
Post process a newly retrieved connection.
|
void |
setDatabase(int index)
Sets the index of the database used by this connection factory.
|
void |
setHostName(String hostName)
Sets the Redis host name for this factory.
|
void |
setPassword(String password)
Sets the password used for authenticating with the Redis server.
|
void |
setPort(int port)
Sets the Redis port.
|
DataAccessException |
translateExceptionIfPossible(RuntimeException ex) |
public JredisConnectionFactory()
JredisConnectionFactory
instance.public JredisConnectionFactory(org.jredis.connector.ConnectionSpec connectionSpec)
JredisConnectionFactory
instance. Will override the other connection parameters
passed to the factory.connectionSpec
- already configured connection.public JredisConnectionFactory(Pool<org.jredis.JRedis> pool)
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public RedisConnection getConnection()
RedisConnectionFactory
getConnection
in interface RedisConnectionFactory
protected RedisConnection postProcessConnection(JredisConnection connection)
connection
- public DataAccessException translateExceptionIfPossible(RuntimeException ex)
translateExceptionIfPossible
in interface PersistenceExceptionTranslator
public String getHostName()
public void setHostName(String hostName)
hostName
- The hostName to set.public int getPort()
public void setPort(int port)
port
- The port to set.public String getPassword()
public void setPassword(String password)
password
- the password to setpublic int getDatabase()
public void setDatabase(int index)
index
- database indexpublic boolean getConvertPipelineAndTxResults()
JredisConnection
does not support pipeline or transactionsgetConvertPipelineAndTxResults
in interface RedisConnectionFactory
public RedisSentinelConnection getSentinelConnection()
getSentinelConnection
in interface RedisConnectionFactory