Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.data.redis.connection.jedis
Class JedisConnectionFactory

    java.lang.Object
      org.springframework.data.redis.connection.jedis.JedisConnectionFactory

All Implemented Interfaces:
  DisposableBean, InitializingBean, PersistenceExceptionTranslator, RedisConnectionFactory

    public class JedisConnectionFactory

extends Object
implements InitializingBean, DisposableBean, RedisConnectionFactory

Connection factory creating Jedis based connections.

Constructor Summary
`JedisConnectionFactory()` Constructs a new `JedisConnectionFactory` instance with default settings (default connection pooling, no shard information).
`JedisConnectionFactory(redis.clients.jedis.JedisPoolConfig poolConfig)` Constructs a new `JedisConnectionFactory` instance using the given pool configuration.
`JedisConnectionFactory(redis.clients.jedis.JedisShardInfo shardInfo)` Constructs a new `JedisConnectionFactory` instance.

Method Summary
`void` | `afterPropertiesSet()`
`void` | `destroy()`
`protected redis.clients.jedis.Jedis` | `fetchJedisConnector()` Returns a Jedis instance to be used as a Redis connection.
`JedisConnection` | `getConnection()` Provides a suitable connection for interacting with Redis.
`boolean` | `getConvertPipelineAndTxResults()` Specifies if pipelined results should be converted to the expected data type.
`int` | `getDatabase()` Returns the index of the database.
`String` | `getHostName()` Returns the Redis hostName.
`String` | `getPassword()` Returns the password used for authenticating with the Redis server.
`redis.clients.jedis.JedisPoolConfig` | `getPoolConfig()` Returns the poolConfig.
`int` | `getPort()` Returns the port used to connect to the Redis instance.
`redis.clients.jedis.JedisShardInfo` | `getShardInfo()` Returns the shardInfo.
`int` | `getTimeout()` Returns the timeout.
`boolean` | `getUsePool()` Indicates the use of a connection pool.
`protected JedisConnection` | `postProcessConnection(JedisConnection connection)` Post process a newly retrieved connection.
`void` | `setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults)` Specifies if pipelined results should be converted to the expected data type.
`void` | `setDatabase(int index)` Sets the index of the database used by this connection factory.
`void` | `setHostName(String hostName)` Sets the Redis hostName.
`void` | `setPassword(String password)` Sets the password used for authenticating with the Redis server.
`void` | `setPoolConfig(redis.clients.jedis.JedisPoolConfig poolConfig)` Sets the pool configuration for this factory.
`void` | `setPort(int port)` Sets the port used to connect to the Redis instance.
`void` | `setShardInfo(redis.clients.jedis.JedisShardInfo shardInfo)` Sets the shard info for this factory.
`void` | `setTimeout(int timeout)`
`void` | `setUsePool(boolean usePool)` Turns on or off the use of connection pooling.
`DataAccessException` | `translateExceptionIfPossible(RuntimeException ex)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JedisConnectionFactory

    public JedisConnectionFactory()

  Constructs a new `JedisConnectionFactory` instance with default settings (default connection pooling, no shard information).

### JedisConnectionFactory

    public JedisConnectionFactory(redis.clients.jedis.JedisShardInfo shardInfo)

  Constructs a new `JedisConnectionFactory` instance. Will override the other connection parameters passed to the factory.

  Parameters:
    `shardInfo` - shard information

### JedisConnectionFactory

    public JedisConnectionFactory(redis.clients.jedis.JedisPoolConfig poolConfig)

  Constructs a new `JedisConnectionFactory` instance using the given pool configuration.

  Parameters:
    `poolConfig` - pool configuration

Method Detail

### fetchJedisConnector

    protected redis.clients.jedis.Jedis fetchJedisConnector()

  Returns a Jedis instance to be used as a Redis connection. The instance can be newly created or retrieved from a pool.

  Returns:
    Jedis instance ready for wrapping into a `RedisConnection`.

### postProcessConnection

    protected JedisConnection postProcessConnection(JedisConnection connection)

  Post process a newly retrieved connection. Useful for decorating or executing initialization commands on a new connection. This implementation simply returns the connection.

  Parameters:
    `connection` -
  Returns:
    processed connection

### afterPropertiesSet

    public void afterPropertiesSet()

  Specified by:
    `afterPropertiesSet` in interface `InitializingBean`

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `DisposableBean`

### getConnection

    public JedisConnection 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 Redis hostName.

  Returns:
    Returns the hostName

### setHostName

    public void setHostName(String hostName)

  Sets the Redis hostName.

  Parameters:
    `hostName` - The hostName to set.

### getPassword

    public String getPassword()

  Returns the password used for authenticating with the Redis server.

  Returns:
    password for authentication

### setPassword

    public void setPassword(String password)

  Sets the password used for authenticating with the Redis server.

  Parameters:
    `password` - the password to set

### getPort

    public int getPort()

  Returns the port used to connect to the Redis instance.

  Returns:
    Redis port.

### setPort

    public void setPort(int port)

  Sets the port used to connect to the Redis instance.

  Parameters:
    `port` - Redis port

### getShardInfo

    public redis.clients.jedis.JedisShardInfo getShardInfo()

  Returns the shardInfo.

  Returns:
    Returns the shardInfo

### setShardInfo

    public void setShardInfo(redis.clients.jedis.JedisShardInfo shardInfo)

  Sets the shard info for this factory.

  Parameters:
    `shardInfo` - The shardInfo to set.

### getTimeout

    public int getTimeout()

  Returns the timeout.

  Returns:
    Returns the timeout

### setTimeout

    public void setTimeout(int timeout)

  Parameters:
    `timeout` - The timeout to set.

### getUsePool

    public boolean getUsePool()

  Indicates the use of a connection pool.

  Returns:
    Returns the use of connection pooling.

### setUsePool

    public void setUsePool(boolean usePool)

  Turns on or off the use of connection pooling.

  Parameters:
    `usePool` - The usePool to set.

### getPoolConfig

    public redis.clients.jedis.JedisPoolConfig getPoolConfig()

  Returns the poolConfig.

  Returns:
    Returns the poolConfig

### setPoolConfig

    public void setPoolConfig(redis.clients.jedis.JedisPoolConfig poolConfig)

  Sets the pool configuration for this factory.

  Parameters:
    `poolConfig` - The poolConfig to set.

### getDatabase

    public int getDatabase()

  Returns the index of the database.

  Returns:
    Returns the database index

### setDatabase

    public void setDatabase(int index)

  Sets the index of the database used by this connection factory. Default is 0.

  Parameters:
    `index` - database index

### getConvertPipelineAndTxResults

    public boolean getConvertPipelineAndTxResults()

  Specifies if pipelined results should be converted to the expected data type. If false, results of `JedisConnection.closePipeline()` and `JedisConnection.exec()` will be of the type returned by the Jedis driver

  Specified by:
    `getConvertPipelineAndTxResults` in interface `RedisConnectionFactory`
  Returns:
    Whether or not to convert pipeline and tx results

### setConvertPipelineAndTxResults

    public void setConvertPipelineAndTxResults(boolean convertPipelineAndTxResults)

  Specifies if pipelined results should be converted to the expected data type. If false, results of `JedisConnection.closePipeline()` and `JedisConnection.exec()` will be of the type returned by the Jedis driver

  Parameters:
    `convertPipelineAndTxResults` - Whether or not to convert pipeline and tx results

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD