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 |
---|---|
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 |
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 delegate, ClientOptions clientOptions, ClientResources clientResources)
CommandExpiryWriter
.delegate
- 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)
RedisChannelWriter
setConnectionFacade
in interface RedisChannelWriter
connectionFacade
- the connection facade (external connection object)public ClientResources getClientResources()
getClientResources
in interface RedisChannelWriter
ClientResources
.public void setAutoFlushCommands(boolean autoFlush)
RedisChannelWriter
true
. 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 RedisChannelWriter
autoFlush
- state of autoFlush.public <K,V,T> RedisCommand<K,V,T> write(RedisCommand<K,V,T> command)
RedisChannelWriter
write
in interface RedisChannelWriter
T
- result typecommand
- the Redis command.public <K,V> Collection<RedisCommand<K,V,?>> write(Collection<? extends RedisCommand<K,V,?>> redisCommands)
RedisChannelWriter
write
in interface RedisChannelWriter
K
- key typeV
- value typeredisCommands
- the Redis commands.public void flushCommands()
RedisChannelWriter
flushCommands
in interface RedisChannelWriter
public void close()
close
in interface RedisChannelWriter
close
in interface Closeable
close
in interface AutoCloseable
public CompletableFuture<Void> closeAsync()
RedisChannelWriter
RedisChannelWriter
.closeAsync
in interface AsyncCloseable
closeAsync
in interface RedisChannelWriter
public void reset()
RedisChannelWriter
reset
in interface RedisChannelWriter
public void setTimeout(Duration timeout)
public RedisChannelWriter getDelegate()
Copyright © 2025 lettuce.io. All rights reserved.