org.springframework.data.redis.connection.jredis
Class JredisPool

java.lang.Object
  extended by org.springframework.data.redis.connection.jredis.JredisPool
All Implemented Interfaces:
Pool<org.jredis.JRedis>

public class JredisPool
extends Object
implements Pool<org.jredis.JRedis>

JRedis implementation of Pool


Constructor Summary
JredisPool(org.jredis.connector.ConnectionSpec connectionSpec)
          Uses the GenericObjectPool.Config defaults for configuring the connection pool
JredisPool(org.jredis.connector.ConnectionSpec connectionSpec, org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
           
JredisPool(String hostName, int port)
          Uses the GenericObjectPool.Config and ConnectionSpec defaults for configuring the connection pool
JredisPool(String hostName, int port, org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
          Uses the ConnectionSpec defaults for configuring the connection pool
JredisPool(String hostName, int port, int dbIndex, String password, int timeout)
          Uses the GenericObjectPool.Config defaults for configuring the connection pool
JredisPool(String hostName, int port, int dbIndex, String password, int timeout, org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
           
 
Method Summary
 void destroy()
          Destroys the pool
 org.jredis.JRedis getResource()
           
 void returnBrokenResource(org.jredis.JRedis resource)
           
 void returnResource(org.jredis.JRedis resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JredisPool

public JredisPool(String hostName,
                  int port)
Uses the GenericObjectPool.Config and ConnectionSpec defaults for configuring the connection pool

Parameters:
hostName - The Redis host
port - The Redis port

JredisPool

public JredisPool(String hostName,
                  int port,
                  org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
Uses the ConnectionSpec defaults for configuring the connection pool

Parameters:
hostName - The Redis host
port - The Redis port
poolConfig - The pool GenericObjectPool.Config

JredisPool

public JredisPool(org.jredis.connector.ConnectionSpec connectionSpec)
Uses the GenericObjectPool.Config defaults for configuring the connection pool

Parameters:
connectionSpec - The ConnectionSpec for connecting to Redis

JredisPool

public JredisPool(org.jredis.connector.ConnectionSpec connectionSpec,
                  org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
Parameters:
connectionSpec - The ConnectionSpec for connecting to Redis
poolConfig - The pool GenericObjectPool.Config

JredisPool

public JredisPool(String hostName,
                  int port,
                  int dbIndex,
                  String password,
                  int timeout)
Uses the GenericObjectPool.Config defaults for configuring the connection pool

Parameters:
hostName - The Redis host
port - The Redis port
dbIndex - The index of the database all connections should use. The database will only be selected on initial creation of the pooled JRedis instances. Since calling select directly on JRedis is not supported, it is assumed that connections can be re-used without subsequent selects.
password - The password used for authenticating with the Redis server or null if no password required
timeout - The socket timeout or 0 to use the default socket timeout

JredisPool

public JredisPool(String hostName,
                  int port,
                  int dbIndex,
                  String password,
                  int timeout,
                  org.apache.commons.pool.impl.GenericObjectPool.Config poolConfig)
Parameters:
hostName - The Redis host
port - The Redis port
dbIndex - The index of the database all connections should use
password - The password used for authenticating with the Redis server or null if no password required
timeout - The socket timeout or 0 to use the default socket timeout
poolConfig - The pool GenericObjectPool.Config
Method Detail

getResource

public org.jredis.JRedis getResource()
Specified by:
getResource in interface Pool<org.jredis.JRedis>
Returns:
A resource, if available

returnBrokenResource

public void returnBrokenResource(org.jredis.JRedis resource)
Specified by:
returnBrokenResource in interface Pool<org.jredis.JRedis>
Parameters:
resource - A broken resource that should be invalidated

returnResource

public void returnResource(org.jredis.JRedis resource)
Specified by:
returnResource in interface Pool<org.jredis.JRedis>
Parameters:
resource - A resource to return to the pool

destroy

public void destroy()
Description copied from interface: Pool
Destroys the pool

Specified by:
destroy in interface Pool<org.jredis.JRedis>