K
- Key type.V
- Value type.public interface StatefulConnection<K,V> extends AutoCloseable, AsyncCloseable
Modifier and Type | Method and Description |
---|---|
void |
addListener(RedisConnectionStateListener listener)
Add a listener for the
RedisConnectionStateListener . |
void |
close()
Close the connection.
|
CompletableFuture<Void> |
closeAsync()
Request to close the connection and return the
CompletableFuture that is notified about its progress. |
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.
|
void |
flushCommands()
Flush pending commands.
|
ClientOptions |
getOptions() |
ClientResources |
getResources() |
Duration |
getTimeout() |
boolean |
isOpen() |
void |
removeListener(RedisConnectionStateListener listener)
Removes a listener.
|
void |
reset()
Deprecated.
since 5.2. To be removed with 7.0. This method is unsafe and can cause protocol offsets (i.e. Redis commands
are completed with previous command values).
|
void |
setAutoFlushCommands(boolean autoFlush)
Disable or enable auto-flush behavior.
|
void |
setTimeout(Duration timeout)
Set the default command timeout for this connection.
|
void addListener(RedisConnectionStateListener listener)
RedisConnectionStateListener
. The listener is notified every time a connect/disconnect/IO
exception happens. The listener is called on the event loop thread so code within the listener methods must not block.listener
- must not be null
.void removeListener(RedisConnectionStateListener listener)
listener
- must not be null
.void setTimeout(Duration timeout)
timeout
- Command timeout.Duration getTimeout()
<T> RedisCommand<K,V,T> dispatch(RedisCommand<K,V,T> command)
T
- result typecommand
- the Redis command.Collection<RedisCommand<K,V,?>> dispatch(Collection<? extends RedisCommand<K,V,?>> commands)
commands
- the Redis commands.void close()
close
in interface AutoCloseable
CompletableFuture<Void> closeAsync()
CompletableFuture
that is notified about its progress. The
connection will become not usable anymore as soon as this method was called.closeAsync
in interface AsyncCloseable
CompletableFuture
that is notified once the operation completes, either because the operation was
successful or because of an error.boolean isOpen()
ClientOptions getOptions()
ClientResources getResources()
@Deprecated void reset()
void setAutoFlushCommands(boolean autoFlush)
true
. If autoFlushCommands is disabled, multiple commands
can be issued without writing them actually to the transport. Commands are buffered until a flushCommands()
is
issued. After calling flushCommands()
commands are sent to the transport and executed by Redis.autoFlush
- state of autoFlush.void flushCommands()
Copyright © 2024 lettuce.io. All rights reserved.