Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic API: Support command batching #432

Closed
mp911de opened this issue Dec 23, 2016 · 1 comment
Closed

Dynamic API: Support command batching #432

mp911de opened this issue Dec 23, 2016 · 1 comment
Assignees
Labels
type: enhancement A general enhancement

Comments

@mp911de
Copy link
Collaborator

mp911de commented Dec 23, 2016

The dynamic API should support batching of commands when using synchronous and asynchronous executions.

@BatchSize(50)
interface MyCommands extends Commands {

  
  void set(String key, String value);

  Future<String> set(String key, String value);

  void set(String key, String value, CommandBatching commandBatching);
}

class CommandBatching {
    public static CommandBatching flush() {
        …
    }

    public static CommandBatching queue() {
        …
    }
}

Command batching for synchronous commands is only possible when the return type is ignored because the command result is only available after command execution. Reactive commands cannot participate in batching because of the deferred execution model.

Batching could be specified either by annotation @BatchSize or a CommandBatching that is specified on a per-invocation basis.

@mp911de mp911de added the type: enhancement A general enhancement label Dec 23, 2016
@mp911de mp911de added this to the Lettuce 5.0.0 milestone Dec 23, 2016
@mp911de
Copy link
Collaborator Author

mp911de commented Jan 30, 2017

Depends on #456

@mp911de mp911de self-assigned this Feb 2, 2017
mp911de added a commit that referenced this issue Feb 9, 2017
Lettuce now supports command batching for dynamic command interfaces. 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.

Command errors that occur during batching cause a BatchException that contains the failed commands.

@batchsize(50)
interface MyCommands extends Commands {

  void set(String key, String value);

  Future<String> get(String key);

  void set(String key, String value, CommandBatching flush);
}

MyCommands commands = …

commands.set("key", "value");
commands.set("key", "value", CommandBatching.flush());
@mp911de mp911de closed this as completed Feb 9, 2017
mp911de added a commit that referenced this issue Feb 9, 2017
Cache types for RedisCodec. Cache annotations for a parameter. Cache future/reactive execution on DeclaredCommandMethod creation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant