public abstract class CommandBatching extends Object
CommandBatching is used to queue commands in a batch queue and flush the command queue on command invocation. Usage:
public interface MyCommands extends Commands {
public void set(String key, String value, CommandBatching batching);
public RedisFuture<String> get(String key, CommandBatching batching)
}
MyCommands commands = …
commands.set("key", "value", CommandBatching.queue());
commands.get("key", CommandBatching.flush());
Using CommandBatching in a method signature turns the command method into a batched command method.
Command batching executes commands in a deferred nature. This also means that at the time of invocation no result is
available. Batching can be only used with synchronous methods without a return value (void) or asynchronous methods
returning a RedisFuture. Reactive command batching is not supported because reactive executed
commands maintain an own subscription lifecycle that is decoupled from command method batching.
BatchSize| Constructor and Description |
|---|
CommandBatching() |
| Modifier and Type | Method and Description |
|---|---|
static CommandBatching |
flush()
Flush the command batch queue after adding a command to the batch queue.
|
static CommandBatching |
queue()
Enqueue the command to the batch queue.
|
public static CommandBatching flush()
CommandBatching to flush the command batch queue after adding a command to the batch queue.public static CommandBatching queue()
CommandBatching to enqueue the command to the batch queue.Copyright © 2020 lettuce.io. All rights reserved.