public class DefaultLettucePool extends Object implements LettucePool, InitializingBean
LettucePool
.Constructor and Description |
---|
DefaultLettucePool()
Constructs a new
DefaultLettucePool instance with default settings. |
DefaultLettucePool(RedisSentinelConfiguration sentinelConfiguration)
Uses the
RedisSentinelConfiguration and RedisClient defaults for configuring the connection pool
based on sentinels. |
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() |
com.lambdaworks.redis.resource.ClientResources |
getClientResources()
Get the
ClientResources to reuse infrastructure. |
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.api.StatefulConnection<byte[],byte[]> |
getResource() |
long |
getTimeout()
Returns the connection timeout (in milliseconds).
|
boolean |
isRedisSentinelAware() |
void |
returnBrokenResource(com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]> resource) |
void |
returnResource(com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]> resource) |
void |
setClientResources(com.lambdaworks.redis.resource.ClientResources clientResources)
Sets the
ClientResources to reuse the client infrastructure. |
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(RedisSentinelConfiguration sentinelConfiguration)
RedisSentinelConfiguration
and RedisClient
defaults for configuring the connection pool
based on sentinels.sentinelConfiguration
- The Sentinel configurationpublic 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 GenericObjectPoolConfig
public boolean isRedisSentinelAware()
RedisSentinelConfiguration
is present.public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
public com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]> getResource()
getResource
in interface Pool<com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]>>
public void returnBrokenResource(com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]> resource)
returnBrokenResource
in interface Pool<com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]>>
resource
- A broken resource that should be invalidatedpublic void returnResource(com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]> resource)
returnResource
in interface Pool<com.lambdaworks.redis.api.StatefulConnection<byte[],byte[]>>
resource
- A resource to return to the poolpublic void destroy()
Pool
public com.lambdaworks.redis.RedisClient getClient()
getClient
in interface LettucePool
public 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 timeoutpublic com.lambdaworks.redis.resource.ClientResources getClientResources()
ClientResources
to reuse infrastructure.public void setClientResources(com.lambdaworks.redis.resource.ClientResources clientResources)
ClientResources
to reuse the client infrastructure. clientResources
- can be null.Copyright © 2011-2016–2016 Pivotal Software, Inc.. All rights reserved.