Interface RedisConnectionFactory
- All Superinterfaces:
PersistenceExceptionTranslator
- All Known Implementing Classes:
JedisConnectionFactory
,LettuceConnectionFactory
Thread-safe factory of Redis connections.
- Author:
- Costin Leau, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionProvides a suitable connection for interacting with Redis Cluster.Provides a suitable connection for interacting with Redis.boolean
Specifies if pipelined results should be converted to the expected data type.Provides a suitable connection for interacting with Redis Sentinel.Methods inherited from interface org.springframework.dao.support.PersistenceExceptionTranslator
translateExceptionIfPossible
-
Method Details
-
getConnection
RedisConnection getConnection()Provides a suitable connection for interacting with Redis.- Returns:
- connection for interacting with Redis.
- Throws:
IllegalStateException
- if the connection factory requires initialization and the factory was not yet initialized.
-
getClusterConnection
RedisClusterConnection getClusterConnection()Provides a suitable connection for interacting with Redis Cluster.- Returns:
- Throws:
IllegalStateException
- if the connection factory requires initialization and the factory was not yet initialized.- Since:
- 1.7
-
getConvertPipelineAndTxResults
boolean getConvertPipelineAndTxResults()Specifies if pipelined results should be converted to the expected data type. If false, results ofRedisConnection.closePipeline()
and {RedisConnection#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:
- Whether or not to convert pipeline and tx results
-
getSentinelConnection
RedisSentinelConnection getSentinelConnection()Provides a suitable connection for interacting with Redis Sentinel.- Returns:
- connection for interacting with Redis Sentinel.
- Throws:
IllegalStateException
- if the connection factory requires initialization and the factory was not yet initialized.- Since:
- 1.4
-