From 61af15765aac538e060e2700d88b0cf06ff83bbd Mon Sep 17 00:00:00 2001 From: Guian Gumpac Date: Thu, 13 Jun 2024 09:05:04 -0700 Subject: [PATCH] Added example for watch returning null --- .../java/glide/api/commands/TransactionsBaseCommands.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/client/src/main/java/glide/api/commands/TransactionsBaseCommands.java b/java/client/src/main/java/glide/api/commands/TransactionsBaseCommands.java index b2f2aad75d..0bb0bdbd84 100644 --- a/java/client/src/main/java/glide/api/commands/TransactionsBaseCommands.java +++ b/java/client/src/main/java/glide/api/commands/TransactionsBaseCommands.java @@ -24,6 +24,12 @@ public interface TransactionsBaseCommands { * transaction.set("sampleKey", "foobar"); * Object[] result = client.exec(transaction).get(); * assert result != null; // Executes successfully and keys are unwatched. + * + * assert client.watch(new String[] {"sampleKey"}).get() == "OK"; + * transaction.set("sampleKey", "foobar"); + * assert client.set("sampleKey", "hello world").get() == "OK"; + * Object[] result = client.exec(transaction).get(); + * assert result == null; // null is returned when the watched key is modified before transaction execution. * } */ CompletableFuture watch(String[] keys);