Skip to content

Commit

Permalink
Polishing #1584
Browse files Browse the repository at this point in the history
Use XX/NX CommandKeywords in SetArgs and ZAddArgs.
  • Loading branch information
mp911de committed Mar 4, 2021
1 parent e1047f9 commit d4a8a12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/main/java/io/lettuce/core/SetArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.lettuce.core;

import static io.lettuce.core.protocol.CommandKeyword.*;

import java.time.Duration;
import java.time.Instant;
import java.util.Date;
Expand Down Expand Up @@ -397,11 +399,11 @@ public <K, V> void build(CommandArgs<K, V> args) {
}

if (nx) {
args.add("NX");
args.add(NX);
}

if (xx) {
args.add("XX");
args.add(XX);
}

if (keepttl) {
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/io/lettuce/core/ZAddArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package io.lettuce.core;

import static io.lettuce.core.protocol.CommandKeyword.*;

import io.lettuce.core.protocol.CommandArgs;

/**
Expand Down Expand Up @@ -164,14 +166,15 @@ public ZAddArgs lt() {
return this;
}

@Override
public <K, V> void build(CommandArgs<K, V> args) {

if (nx) {
args.add("NX");
args.add(NX);
}

if (xx) {
args.add("XX");
args.add(XX);
}

if (gt) {
Expand All @@ -183,7 +186,7 @@ public <K, V> void build(CommandArgs<K, V> args) {
}

if (ch) {
args.add("CH");
args.add(CH);
}
}

Expand Down

0 comments on commit d4a8a12

Please sign in to comment.