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 suitableconnection
for interacting with Redis Cluster.Returns a suitableconnection
for interacting with Redis.boolean
Specifies if pipelined results should be converted to the expected data type.Returns a suitableconnection
for 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:
true
to convert pipeline and transaction results;false
otherwise.
-
getConnection
RedisConnection getConnection()Returns a suitableconnection
for interacting with Redis.- Returns:
connection
for interacting with Redis.- Throws:
IllegalStateException
- if the connection factory requires initialization and the factory has not yet been initialized.
-
getClusterConnection
RedisClusterConnection getClusterConnection()Returns a suitableconnection
for interacting with Redis Cluster.- Returns:
- a
connection
for 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 suitableconnection
for interacting with Redis Sentinel.- Returns:
- a
connection
for interacting with Redis Sentinel. - Throws:
IllegalStateException
- if the connection factory requires initialization and the factory has not yet been initialized.- Since:
- 1.4
-