Constructor and Description |
---|
RedisClient(io.netty.channel.EventLoopGroup group,
String host)
Create a new client that connects to the supplied host on the default port.
|
RedisClient(io.netty.channel.EventLoopGroup group,
String host,
int port)
Create a new client that connects to the supplied host and port.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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.
|
InetSocketAddress |
getAddr() |
void |
setDefaultTimeout(long timeout,
TimeUnit unit)
Set the default timeout for
connections created by
this client. |
void |
shutdown()
Shutdown this client and close all open connections.
|
String |
toString() |
public RedisClient(io.netty.channel.EventLoopGroup group, String host)
host
- Server hostname.public void setDefaultTimeout(long timeout, TimeUnit unit)
connections
created by
this client. The timeout applies to connection attempts and non-blocking
commands.timeout
- Default connection timeout.unit
- Unit of time for the timeout.public RedisConnection<String,String> connect()
public RedisAsyncConnection<String,String> connectAsync()
public RedisPubSubConnection<String,String> connectPubSub()
public <K,V> RedisConnection<K,V> connect(RedisCodec<K,V> codec)
codec
to encode/decode keys and values.codec
- Use this codec to encode/decode keys and values.public <K,V> RedisAsyncConnection<K,V> connectAsync(RedisCodec<K,V> codec)
codec
to encode/decode keys and values.codec
- Use this codec to encode/decode keys and values.public <K,V> RedisPubSubConnection<K,V> connectPubSub(RedisCodec<K,V> codec)
codec
to encode/decode keys and values.codec
- Use this codec to encode/decode keys and values.public void shutdown()
public InetSocketAddress getAddr()
Copyright © 2014. All rights reserved.