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.true if 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)
RedisChannelWritertrue. If autoFlushCommands is disabled, multiple commands can
be issued without writing them actually to the transport. Commands are buffered until a RedisChannelWriter.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 type.command - the Redis command.public <K,V> Collection<RedisCommand<K,V,?>> write(Collection<? extends RedisCommand<K,V,?>> redisCommands)
RedisChannelWriterwrite in interface RedisChannelWriterK - key type.V - value type.redisCommands - 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 © 2021 lettuce.io. All rights reserved.