public class CommandExpiryWriter extends Object implements RedisChannelWriter
RedisChannelWriter that expires commands. Command timeout starts at the time the command is written
regardless to flushing mode (user-controlled batching).TimeoutOptions| Constructor and Description |
|---|
CommandExpiryWriter(RedisChannelWriter writer,
ClientOptions clientOptions,
ClientResources clientResources)
Create a new
CommandExpiryWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
CompletableFuture<Void> |
closeAsync()
Asynchronously close the
RedisChannelWriter. |
void |
flushCommands()
Flush pending commands.
|
ClientResources |
getClientResources() |
static boolean |
isSupported(ClientOptions clientOptions)
Check whether
ClientOptions is configured to timeout commands. |
void |
reset()
Reset the command state.
|
void |
setAutoFlushCommands(boolean autoFlush)
Disable or enable auto-flush behavior.
|
void |
setConnectionFacade(ConnectionFacade connectionFacade)
Set the corresponding connection facade in order to notify it about channel active/inactive state.
|
void |
setTimeout(Duration timeout) |
<K,V> Collection<RedisCommand<K,V,?>> |
write(Collection<? extends RedisCommand<K,V,?>> redisCommands)
Write multiple commands on the channel.
|
<K,V,T> RedisCommand<K,V,T> |
write(RedisCommand<K,V,T> command)
Write a command on the channel.
|
public CommandExpiryWriter(RedisChannelWriter writer, ClientOptions clientOptions, ClientResources clientResources)
CommandExpiryWriter.writer - must not be null.clientOptions - must not be null.clientResources - must not be null.public static boolean isSupported(ClientOptions clientOptions)
ClientOptions is configured to timeout commands.clientOptions - must not be null.ClientOptions are configured to timeout commands.public void setConnectionFacade(ConnectionFacade connectionFacade)
RedisChannelWritersetConnectionFacade in interface RedisChannelWriterconnectionFacade - the connection facade (external connection object)public ClientResources getClientResources()
getClientResources in interface RedisChannelWriterClientResources.public void setAutoFlushCommands(boolean autoFlush)
RedisChannelWriterRedisChannelWriter.flushCommands() is
issued. After calling RedisChannelWriter.flushCommands() commands are sent to the transport and executed by Redis.setAutoFlushCommands in interface RedisChannelWriterautoFlush - state of autoFlush.public <K,V,T> RedisCommand<K,V,T> write(RedisCommand<K,V,T> command)
RedisChannelWriterwrite in interface RedisChannelWriterT - result typecommand - the Redis command.public <K,V> Collection<RedisCommand<K,V,?>> write(Collection<? extends RedisCommand<K,V,?>> redisCommands)
RedisChannelWriterwrite in interface RedisChannelWriterK - key typeV - value typeredisCommands - the Redis commands.public void flushCommands()
RedisChannelWriterflushCommands in interface RedisChannelWriterpublic void close()
close in interface RedisChannelWriterclose in interface Closeableclose in interface AutoCloseablepublic CompletableFuture<Void> closeAsync()
RedisChannelWriterRedisChannelWriter.closeAsync in interface AsyncCloseablecloseAsync in interface RedisChannelWriterpublic void reset()
RedisChannelWriterreset in interface RedisChannelWriterpublic void setTimeout(Duration timeout)
Copyright © 2019 lettuce.io. All rights reserved.