public class DefaultLettucePool extends Object implements LettucePool, InitializingBean
LettucePool.| Constructor and Description |
|---|
DefaultLettucePool()
Constructs a new
DefaultLettucePool instance with default settings. |
DefaultLettucePool(String hostName,
int port)
Uses the
Config and RedisClient defaults for configuring the connection pool |
DefaultLettucePool(String hostName,
int port,
org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
Uses the
RedisClient defaults for configuring the connection pool |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
destroy()
Destroys the pool
|
com.lambdaworks.redis.RedisClient |
getClient() |
int |
getDatabase()
Returns the index of the database.
|
String |
getHostName()
Returns the current host.
|
String |
getPassword()
Returns the password used for authenticating with the Redis server.
|
org.apache.commons.pool2.impl.GenericObjectPoolConfig |
getPoolConfig() |
int |
getPort()
Returns the current port.
|
com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> |
getResource() |
long |
getTimeout()
Returns the connection timeout (in milliseconds).
|
void |
returnBrokenResource(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> resource) |
void |
returnResource(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> resource) |
void |
setDatabase(int index)
Sets the index of the database used by this connection pool.
|
void |
setHostName(String host)
Sets the host.
|
void |
setPassword(String password)
Sets the password used for authenticating with the Redis server.
|
void |
setPoolConfig(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig) |
void |
setPort(int port)
Sets the port.
|
void |
setTimeout(long timeout)
Sets the connection timeout (in milliseconds).
|
public DefaultLettucePool()
DefaultLettucePool instance with default settings.public DefaultLettucePool(String hostName, int port)
Config and RedisClient defaults for configuring the connection poolhostName - The Redis hostport - The Redis portpublic DefaultLettucePool(String hostName, int port, org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
RedisClient defaults for configuring the connection poolhostName - The Redis hostport - The Redis portpoolConfig - The pool GenericObjectPoolConfigpublic void afterPropertiesSet()
afterPropertiesSet in interface InitializingBeanpublic com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> getResource()
getResource in interface Pool<com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]>>public void returnBrokenResource(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> resource)
returnBrokenResource in interface Pool<com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]>>resource - A broken resource that should be invalidatedpublic void returnResource(com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]> resource)
returnResource in interface Pool<com.lambdaworks.redis.RedisAsyncConnection<byte[],byte[]>>resource - A resource to return to the poolpublic void destroy()
Poolpublic com.lambdaworks.redis.RedisClient getClient()
getClient in interface LettucePoolRedisClient used to create pooled connectionspublic org.apache.commons.pool2.impl.GenericObjectPoolConfig getPoolConfig()
public void setPoolConfig(org.apache.commons.pool2.impl.GenericObjectPoolConfig poolConfig)
poolConfig - The pool configuration to usepublic int getDatabase()
public void setDatabase(int index)
index - database indexpublic String getPassword()
public void setPassword(String password)
password - the password to setpublic String getHostName()
public void setHostName(String host)
host - the host to setpublic int getPort()
public void setPort(int port)
port - the port to setpublic long getTimeout()
public void setTimeout(long timeout)
timeout - connection timeout