|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.lambdaworks.redis.RedisClient
public class RedisClient
A scalable thread-safe Redis client. Multiple threads may share one connection provided they avoid blocking and transactional operations such as BLPOP and MULTI/EXEC.
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | ||
|---|---|---|
RedisConnection<String,String> |
connect()
Open a new synchronous connection to the redis server that treats keys and values as UTF-8 strings. |
|
|
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. |
|
|
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. |
|
|
connectPubSub(RedisCodec<K,V> codec)
Open a new pub/sub connection to the redis server. |
|
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. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RedisClient(String host)
host - Server hostname.
public RedisClient(String host,
int port)
timeout
after 60 seconds.
host - Server hostname.port - Server port.| Method Detail |
|---|
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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||