K - Key type.V - Value type.public class StatefulRedisConnectionImpl<K,V> extends RedisChannelHandler<K,V> implements StatefulRedisConnection<K,V>
StatefulRedisConnectionImpl
A ConnectionWatchdog monitors each connection and reconnects automatically until RedisChannelHandler.close() is called. All
pending commands will be (re)sent after successful reconnection.| Modifier and Type | Field and Description |
|---|---|
protected RedisAsyncCommandsImpl<K,V> |
async |
protected RedisCodec<K,V> |
codec |
protected MultiOutput<K,V> |
multi |
protected RedisReactiveCommandsImpl<K,V> |
reactive |
protected RedisCommands<K,V> |
sync |
| Constructor and Description |
|---|
StatefulRedisConnectionImpl(RedisChannelWriter writer,
RedisCodec<K,V> codec,
Duration timeout)
Initialize a new connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
activated()
Notification when the connection becomes active (connected).
|
RedisAsyncCommands<K,V> |
async()
Returns the
RedisAsyncCommands API for the current connection. |
Collection<RedisCommand<K,V,?>> |
dispatch(Collection<? extends RedisCommand<K,V,?>> commands)
Dispatch multiple command in a single write on the channel.
|
<T> RedisCommand<K,V,T> |
dispatch(RedisCommand<K,V,T> command)
Dispatch a command.
|
boolean |
isMulti() |
protected RedisAsyncCommandsImpl<K,V> |
newRedisAsyncCommandsImpl()
Create a new instance of
RedisAsyncCommandsImpl. |
protected RedisReactiveCommandsImpl<K,V> |
newRedisReactiveCommandsImpl()
Create a new instance of
RedisReactiveCommandsImpl. |
protected RedisCommands<K,V> |
newRedisSyncCommandsImpl()
Create a new instance of
RedisCommands. |
protected <T> RedisCommand<K,V,T> |
preProcessCommand(RedisCommand<K,V,T> command) |
RedisReactiveCommands<K,V> |
reactive()
Returns the
RedisReactiveCommands API for the current connection. |
void |
setClientName(String clientName) |
RedisCommands<K,V> |
sync()
Returns the
RedisCommands API for the current connection. |
addListener, close, closeAsync, deactivated, flushCommands, getChannelWriter, getOptions, getResources, getTimeout, isClosed, isOpen, registerCloseables, reset, setAutoFlushCommands, setOptions, setTimeout, setTimeout, syncHandlerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, closeAsync, flushCommands, getOptions, getResources, getTimeout, isOpen, reset, setAutoFlushCommands, setTimeout, setTimeoutprotected final RedisCodec<K,V> codec
protected final RedisCommands<K,V> sync
protected final RedisAsyncCommandsImpl<K,V> async
protected final RedisReactiveCommandsImpl<K,V> reactive
protected MultiOutput<K,V> multi
public StatefulRedisConnectionImpl(RedisChannelWriter writer, RedisCodec<K,V> codec, Duration timeout)
writer - the channel writercodec - Codec used to encode/decode keys and values.timeout - Maximum time to wait for a response.public RedisAsyncCommands<K,V> async()
StatefulRedisConnectionRedisAsyncCommands API for the current connection. Does not create a new connection.async in interface StatefulRedisConnection<K,V>protected RedisCommands<K,V> newRedisSyncCommandsImpl()
RedisCommands. Can be overriden to extend.protected RedisAsyncCommandsImpl<K,V> newRedisAsyncCommandsImpl()
RedisAsyncCommandsImpl. Can be overriden to extend.public RedisReactiveCommands<K,V> reactive()
StatefulRedisConnectionRedisReactiveCommands API for the current connection. Does not create a new connection.reactive in interface StatefulRedisConnection<K,V>protected RedisReactiveCommandsImpl<K,V> newRedisReactiveCommandsImpl()
RedisReactiveCommandsImpl. Can be overriden to extend.public RedisCommands<K,V> sync()
StatefulRedisConnectionRedisCommands API for the current connection. Does not create a new connection.sync in interface StatefulRedisConnection<K,V>public boolean isMulti()
isMulti in interface StatefulRedisConnection<K,V>public void activated()
RedisChannelHandleractivated in interface ConnectionFacadeactivated in class RedisChannelHandler<K,V>public <T> RedisCommand<K,V,T> dispatch(RedisCommand<K,V,T> command)
StatefulConnectiondispatch in interface StatefulConnection<K,V>dispatch in class RedisChannelHandler<K,V>T - result typecommand - the Redis command.public Collection<RedisCommand<K,V,?>> dispatch(Collection<? extends RedisCommand<K,V,?>> commands)
StatefulConnectiondispatch in interface StatefulConnection<K,V>dispatch in class RedisChannelHandler<K,V>commands - the Redis commands.protected <T> RedisCommand<K,V,T> preProcessCommand(RedisCommand<K,V,T> command)
public void setClientName(String clientName)
Copyright © 2019 lettuce.io. All rights reserved.