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 delegate,
ClientOptions clientOptions,
ClientResources clientResources)
Create a new
CommandExpiryWriter. |
| Modifier and Type | Method and Description |
|---|---|
static RedisChannelWriter |
buildCommandExpiryWriter(RedisChannelWriter delegate,
ClientOptions clientOptions,
ClientResources clientResources)
Create a new
CommandExpiryWriter or MaintenanceAwareExpiryWriter depending on the ClientOptions
configuration. |
void |
close() |
CompletableFuture<Void> |
closeAsync()
Asynchronously close the
RedisChannelWriter. |
void |
flushCommands()
Flush pending commands.
|
ClientResources |
getClientResources() |
RedisChannelWriter |
getDelegate() |
static boolean |
isSupported(ClientOptions clientOptions)
Check whether
ClientOptions is configured to timeout commands. |
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 delegate, ClientOptions clientOptions, ClientResources clientResources)
CommandExpiryWriter.delegate - must not be null.clientOptions - must not be null.clientResources - must not be null.public static RedisChannelWriter buildCommandExpiryWriter(RedisChannelWriter delegate, ClientOptions clientOptions, ClientResources clientResources)
CommandExpiryWriter or MaintenanceAwareExpiryWriter depending on the ClientOptions
configuration.delegate - must not be null.clientOptions - must not be null.clientResources - must not be null.CommandExpiryWriter or MaintenanceAwareExpiryWriter.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 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 setTimeout(Duration timeout)
public RedisChannelWriter getDelegate()
Copyright © 2025 lettuce.io. All rights reserved.