Spring Data Key-Value

org.springframework.data.keyvalue.redis.connection.jredis
Class JredisConnectionFactory

java.lang.Object
  extended by org.springframework.data.keyvalue.redis.connection.jredis.JredisConnectionFactory
All Implemented Interfaces:
DisposableBean, InitializingBean, PersistenceExceptionTranslator, RedisConnectionFactory

public class JredisConnectionFactory
extends Object
implements InitializingBean, DisposableBean, RedisConnectionFactory

Connection factory using creating JRedis based connections.

Author:
Costin Leau

Constructor Summary
JredisConnectionFactory()
          Constructs a new JredisConnectionFactory instance.
JredisConnectionFactory(org.jredis.connector.ConnectionSpec connectionSpec)
          Constructs a new JredisConnectionFactory instance.
 
Method Summary
 void afterPropertiesSet()
           
 void destroy()
           
 RedisConnection getConnection()
          Provides a suitable connection for interacting with Redis.
 String getHostName()
          Returns the Redis host name of this factory.
 String getPassword()
          Returns the password used for authenticating with the Redis server.
 int getPoolSize()
          Returns the pool size of this factory.
 int getPort()
          Returns the Redis port.
 boolean getUsePool()
          Indicates the use of a connection pool.
 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 setPoolSize(int poolSize)
          Sets the connection pool size of the underlying factory.
 void setPort(int port)
          Sets the Redis port.
 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

JredisConnectionFactory

public JredisConnectionFactory()
Constructs a new JredisConnectionFactory instance.


JredisConnectionFactory

public JredisConnectionFactory(org.jredis.connector.ConnectionSpec connectionSpec)
Constructs a new JredisConnectionFactory instance. Will override the other connection parameters passed to the factory.

Parameters:
connectionSpec - already configured connection.
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

destroy

public void destroy()
Specified by:
destroy in interface DisposableBean

getConnection

public RedisConnection 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 host name of this factory.

Returns:
Returns the hostName

setHostName

public void setHostName(String hostName)
Sets the Redis host name for this factory.

Parameters:
hostName - The hostName to set.

getPort

public int getPort()
Returns the Redis port.

Returns:
Returns the port

setPort

public void setPort(int port)
Sets the Redis port.

Parameters:
port - The port 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

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.

getPoolSize

public int getPoolSize()
Returns the pool size of this factory.

Returns:
Returns the poolSize

setPoolSize

public void setPoolSize(int poolSize)
Sets the connection pool size of the underlying factory.

Parameters:
poolSize - The poolSize to set.

Spring Data Key-Value

Copyright © 2010-2011 SpringSource. All Rights Reserved.