public class RedisClient extends AbstractRedisClient
channels, clientOptions, closeableResources, connectionEvents, eventLoopGroup, eventLoopGroups, logger, timeout, timer, unit| Constructor and Description |
|---|
RedisClient()
Creates a uri-less RedisClient.
|
RedisClient(RedisURI redisURI)
Create a new client that connects to the supplied host and port.
|
RedisClient(String host)
Create a new client that connects to the supplied host on the default port.
|
RedisClient(String host,
int port)
Create a new client that connects to the supplied host and port.
|
| Modifier and Type | Method and Description |
|---|---|
RedisConnectionPool<RedisAsyncConnection<String,String>> |
asyncPool()
Creates a connection pool for asynchronous connections. 5 max idle connections and 20 max active connections.
|
RedisConnectionPool<RedisAsyncConnection<String,String>> |
asyncPool(int maxIdle,
int maxActive)
Creates a connection pool for asynchronous connections.
|
<K,V> RedisConnectionPool<RedisAsyncConnection<K,V>> |
asyncPool(RedisCodec<K,V> codec,
int maxIdle,
int maxActive)
Creates a connection pool for asynchronous connections.
|
RedisConnection<String,String> |
connect()
Open a new synchronous connection to the redis server that treats keys and values as UTF-8 strings.
|
<K,V> RedisConnection<K,V> |
connect(RedisCodec<K,V> codec)
Open a new synchronous connection to the redis server.
|
RedisConnection<String,String> |
connect(RedisURI redisURI)
Open a new synchronous connection to the supplied
RedisURI that treats keys and values as UTF-8 strings. |
RedisAsyncConnection<String,String> |
connectAsync()
Open a new asynchronous connection to the redis server that treats keys and values as UTF-8 strings.
|
<K,V> RedisAsyncConnection<K,V> |
connectAsync(RedisCodec<K,V> codec)
Open a new asynchronous connection to the redis server.
|
RedisAsyncConnection<String,String> |
connectAsync(RedisURI redisURI)
Open a new asynchronous connection to the supplied
RedisURI that treats keys and values as UTF-8 strings. |
RedisPubSubConnection<String,String> |
connectPubSub()
Open a new pub/sub connection to the redis server that treats keys and values as UTF-8 strings.
|
<K,V> RedisPubSubConnection<K,V> |
connectPubSub(RedisCodec<K,V> codec)
Open a new pub/sub connection to the redis server.
|
protected <K,V> RedisPubSubConnection<K,V> |
connectPubSub(RedisCodec<K,V> codec,
RedisURI redisURI) |
RedisPubSubConnection<String,String> |
connectPubSub(RedisURI redisURI)
Open a new pub/sub connection to the supplied
RedisURI that treats keys and values as UTF-8 strings. |
RedisSentinelAsyncConnection<String,String> |
connectSentinelAsync()
Creates an asynchronous connection to Sentinel.
|
<K,V> RedisSentinelAsyncConnection<K,V> |
connectSentinelAsync(RedisCodec<K,V> codec)
Creates an asynchronous connection to Sentinel.
|
RedisSentinelAsyncConnection<String,String> |
connectSentinelAsync(RedisURI redisURI)
Creates an asynchronous connection to Sentinel.
|
protected SocketAddress |
getSocketAddress(RedisURI redisURI) |
protected long |
makeTimeout() |
protected <K,V> RedisAsyncConnectionImpl<K,V> |
newRedisAsyncConnectionImpl(RedisChannelWriter<K,V> channelWriter,
RedisCodec<K,V> codec,
long timeout,
TimeUnit unit)
Construct a new
RedisAsyncConnectionImpl. |
protected <K,V> RedisPubSubConnectionImpl<K,V> |
newRedisPubSubConnectionImpl(RedisChannelWriter<K,V> channelWriter,
RedisCodec<K,V> codec,
long timeout,
TimeUnit unit)
Construct a new
RedisPubSubConnectionImpl. |
protected <K,V> com.lambdaworks.redis.RedisSentinelAsyncConnectionImpl<K,V> |
newRedisSentinelAsyncConnectionImpl(RedisChannelWriter<K,V> channelWriter,
RedisCodec<K,V> codec,
long timeout,
TimeUnit unit)
Construct a new
RedisSentinelAsyncConnectionImpl. |
RedisConnectionPool<RedisConnection<String,String>> |
pool()
Creates a connection pool for synchronous connections. 5 max idle connections and 20 max active connections.
|
RedisConnectionPool<RedisConnection<String,String>> |
pool(int maxIdle,
int maxActive)
Creates a connection pool for synchronous connections.
|
<K,V> RedisConnectionPool<RedisConnection<K,V>> |
pool(RedisCodec<K,V> codec,
int maxIdle,
int maxActive)
Creates a connection pool for synchronous connections.
|
addListener, channelType, connectAsyncImpl, connectionBuilder, getChannelCount, getOptions, getResourceCount, initializeChannel, removeListener, setDefaultTimeout, setOptions, shutdown, shutdown, syncHandlerpublic RedisClient()
RedisURI on
connecting. Methods without having a RedisURI will fail with a IllegalStateException.public RedisClient(String host)
host - Server hostname.public RedisClient(String host, int port)
timeout after 60 seconds.host - Server hostname.port - Server port.public RedisConnectionPool<RedisConnection<String,String>> pool()
RedisConnectionPool instancepublic RedisConnectionPool<RedisConnection<String,String>> pool(int maxIdle, int maxActive)
maxIdle - max idle connections in poolmaxActive - max active connections in poolRedisConnectionPool instancepublic <K,V> RedisConnectionPool<RedisConnection<K,V>> pool(RedisCodec<K,V> codec, int maxIdle, int maxActive)
K - Key type.V - Value type.codec - the codec to usemaxIdle - max idle connections in poolmaxActive - max active connections in poolRedisConnectionPool instanceprotected long makeTimeout()
public RedisConnectionPool<RedisAsyncConnection<String,String>> asyncPool()
RedisConnectionPool instancepublic RedisConnectionPool<RedisAsyncConnection<String,String>> asyncPool(int maxIdle, int maxActive)
maxIdle - max idle connections in poolmaxActive - max active connections in poolRedisConnectionPool instancepublic <K,V> RedisConnectionPool<RedisAsyncConnection<K,V>> asyncPool(RedisCodec<K,V> codec, int maxIdle, int maxActive)
K - Key type.V - Value type.codec - the codec to usemaxIdle - max idle connections in poolmaxActive - max active connections in poolRedisConnectionPool instancepublic RedisConnection<String,String> connect()
public <K,V> RedisConnection<K,V> connect(RedisCodec<K,V> codec)
codec to encode/decode keys
and values.K - Key type.V - Value type.codec - Use this codec to encode/decode keys and values, must note be nullpublic RedisConnection<String,String> connect(RedisURI redisURI)
RedisURI that treats keys and values as UTF-8 strings.redisURI - the redis server to connect to, must not be nullpublic RedisAsyncConnection<String,String> connectAsync()
public <K,V> RedisAsyncConnection<K,V> connectAsync(RedisCodec<K,V> codec)
codec to encode/decode keys
and values.K - Key type.V - Value type.codec - Use this codec to encode/decode keys and values, must not be nullpublic RedisAsyncConnection<String,String> connectAsync(RedisURI redisURI)
RedisURI that treats keys and values as UTF-8 strings.redisURI - the redis server to connect to, must not be nullpublic RedisPubSubConnection<String,String> connectPubSub()
public RedisPubSubConnection<String,String> connectPubSub(RedisURI redisURI)
RedisURI that treats keys and values as UTF-8 strings.redisURI - the redis server to connect to, must not be nullpublic <K,V> RedisPubSubConnection<K,V> connectPubSub(RedisCodec<K,V> codec)
codec to encode/decode keys and
values.K - Key type.V - Value type.codec - Use this codec to encode/decode keys and values, must not be nullprotected <K,V> RedisPubSubConnection<K,V> connectPubSub(RedisCodec<K,V> codec, RedisURI redisURI)
public RedisSentinelAsyncConnection<String,String> connectSentinelAsync()
public <K,V> RedisSentinelAsyncConnection<K,V> connectSentinelAsync(RedisCodec<K,V> codec)
K - Key type.V - Value type.codec - Use this codec to encode/decode keys and values, must not be nullpublic RedisSentinelAsyncConnection<String,String> connectSentinelAsync(RedisURI redisURI)
redisURI - the redis server to connect to, must not be nullprotected <K,V> RedisAsyncConnectionImpl<K,V> newRedisAsyncConnectionImpl(RedisChannelWriter<K,V> channelWriter, RedisCodec<K,V> codec, long timeout, TimeUnit unit)
RedisAsyncConnectionImpl. Can be overridden in order to construct a subclass of
RedisAsyncConnectionImplK - Key type.V - Value type.channelWriter - the channel writercodec - the codec to usetimeout - Timeout valueunit - Timeout unitprotected <K,V> com.lambdaworks.redis.RedisSentinelAsyncConnectionImpl<K,V> newRedisSentinelAsyncConnectionImpl(RedisChannelWriter<K,V> channelWriter, RedisCodec<K,V> codec, long timeout, TimeUnit unit)
RedisSentinelAsyncConnectionImpl. Can be overridden in order to construct a subclass of
RedisSentinelAsyncConnectionImplK - Key type.V - Value type.channelWriter - the channel writercodec - the codec to usetimeout - Timeout valueunit - Timeout unitprotected <K,V> RedisPubSubConnectionImpl<K,V> newRedisPubSubConnectionImpl(RedisChannelWriter<K,V> channelWriter, RedisCodec<K,V> codec, long timeout, TimeUnit unit)
RedisPubSubConnectionImpl. Can be overridden in order to construct a subclass of
RedisPubSubConnectionImplK - Key type.V - Value type.channelWriter - the channel writercodec - the codec to usetimeout - Timeout valueunit - Timeout unitprotected SocketAddress getSocketAddress(RedisURI redisURI) throws InterruptedException, TimeoutException, ExecutionException
Copyright © 2015. All rights reserved.