Interface RedisConnectionFactory
- All Superinterfaces:
PersistenceExceptionTranslator
- All Known Implementing Classes:
JedisConnectionFactory,LettuceConnectionFactory
Thread-safe factory of Redis connections.
- Author:
- Costin Leau, Christoph Strobl, John Blum
-
Method Summary
Modifier and TypeMethodDescriptionReturns a suitableconnectionfor interacting with Redis Cluster.Returns a suitableconnectionfor interacting with Redis.booleanSpecifies if pipelined results should be converted to the expected data type.Returns a suitableconnectionfor interacting with Redis Sentinel.Methods inherited from interface org.springframework.dao.support.PersistenceExceptionTranslator
translateExceptionIfPossible
-
Method Details
-
getConvertPipelineAndTxResults
boolean getConvertPipelineAndTxResults()Specifies if pipelined results should be converted to the expected data type.If false, results of
RedisConnection.closePipeline()andRedisTxCommands.exec()will be of the type returned by the underlying driver. This method is mostly for backwards compatibility with 1.0. It is generally always a good idea to allow results to be converted and deserialized. In fact, this is now the default behavior.- Returns:
trueto convert pipeline and transaction results;falseotherwise.
-
getConnection
RedisConnection getConnection()Returns a suitableconnectionfor interacting with Redis.- Returns:
connectionfor interacting with Redis.- Throws:
IllegalStateException- if the connection factory requires initialization and the factory has not yet been initialized.
-
getClusterConnection
RedisClusterConnection getClusterConnection()Returns a suitableconnectionfor interacting with Redis Cluster.- Returns:
- a
connectionfor interacting with Redis Cluster. - Throws:
IllegalStateException- if the connection factory requires initialization and the factory has not yet been initialized.- Since:
- 1.7
-
getSentinelConnection
RedisSentinelConnection getSentinelConnection()Returns a suitableconnectionfor interacting with Redis Sentinel.- Returns:
- a
connectionfor interacting with Redis Sentinel. - Throws:
IllegalStateException- if the connection factory requires initialization and the factory has not yet been initialized.- Since:
- 1.4
-