Skip to content

Commit

Permalink
Separated unwatch to have different docs for standalone (valkey-io#1597)
Browse files Browse the repository at this point in the history
Separated unwatch to have different docs for standalone (#372)

* Separated unwatch to have different docs for standalone

* Added line break
  • Loading branch information
GumpacG authored and Chloe Yip committed Jun 19, 2024
1 parent 94dfaef commit dd8724b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 23 deletions.
6 changes: 0 additions & 6 deletions java/client/src/main/java/glide/api/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
import static redis_request.RedisRequestOuterClass.RequestType.TTL;
import static redis_request.RedisRequestOuterClass.RequestType.Touch;
import static redis_request.RedisRequestOuterClass.RequestType.Type;
import static redis_request.RedisRequestOuterClass.RequestType.UnWatch;
import static redis_request.RedisRequestOuterClass.RequestType.Unlink;
import static redis_request.RedisRequestOuterClass.RequestType.Watch;
import static redis_request.RedisRequestOuterClass.RequestType.XAdd;
Expand Down Expand Up @@ -1900,9 +1899,4 @@ public CompletableFuture<Long> lcsLen(@NonNull String key1, @NonNull String key2
public CompletableFuture<String> watch(@NonNull String[] keys) {
return commandManager.submitNewCommand(Watch, keys, this::handleStringResponse);
}

@Override
public CompletableFuture<String> unwatch() {
return commandManager.submitNewCommand(UnWatch, new String[0], this::handleStringResponse);
}
}
10 changes: 9 additions & 1 deletion java/client/src/main/java/glide/api/RedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
import static redis_request.RedisRequestOuterClass.RequestType.Ping;
import static redis_request.RedisRequestOuterClass.RequestType.Select;
import static redis_request.RedisRequestOuterClass.RequestType.Time;
import static redis_request.RedisRequestOuterClass.RequestType.UnWatch;

import glide.api.commands.ConnectionManagementCommands;
import glide.api.commands.GenericCommands;
import glide.api.commands.ScriptingAndFunctionsCommands;
import glide.api.commands.ServerManagementCommands;
import glide.api.commands.TransactionsCommands;
import glide.api.models.Transaction;
import glide.api.models.commands.FlushMode;
import glide.api.models.commands.InfoOptions;
Expand All @@ -56,7 +58,8 @@ public class RedisClient extends BaseClient
implements GenericCommands,
ServerManagementCommands,
ConnectionManagementCommands,
ScriptingAndFunctionsCommands {
ScriptingAndFunctionsCommands,
TransactionsCommands {

protected RedisClient(ConnectionManager connectionManager, CommandManager commandManager) {
super(connectionManager, commandManager);
Expand Down Expand Up @@ -297,4 +300,9 @@ public CompletableFuture<Map<String, Map<String, Object>>> functionStats() {
new String[0],
response -> handleFunctionStatsResponse(handleMapResponse(response)));
}

@Override
public CompletableFuture<String> unwatch() {
return commandManager.submitNewCommand(UnWatch, new String[0], this::handleStringResponse);
}
}
5 changes: 5 additions & 0 deletions java/client/src/main/java/glide/api/RedisClusterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,9 @@ public CompletableFuture<String> unwatch(@NonNull Route route) {
return commandManager.submitNewCommand(
UnWatch, new String[0], route, this::handleStringResponse);
}

@Override
public CompletableFuture<String> unwatch() {
return commandManager.submitNewCommand(UnWatch, new String[0], this::handleStringResponse);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,4 @@ public interface TransactionsBaseCommands {
* }</pre>
*/
CompletableFuture<String> watch(String[] keys);

/**
* Flushes all the previously watched keys for a transaction. Executing a transaction will
* automatically flush all previously watched keys.
*
* @see <a href="https://redis.io/docs/latest/commands/unwatch/">redis.io</a> for details.
* @return <code>OK</code>.
* @example
* <pre>{@code
* assert client.watch(new String[] {"sampleKey"}).get().equals("OK");
* assert client.unwatch().get().equals("OK"); // Flushes "sampleKey" from watched keys.
* }</pre>
*/
CompletableFuture<String> unwatch();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
public interface TransactionsClusterCommands {
/**
* Flushes all the previously watched keys for a transaction. Executing a transaction will
* automatically flush all previously watched keys. The command will be routed to all primary
* nodes.
* automatically flush all previously watched keys.<br>
* The command will be routed to all primary nodes.
*
* @see <a href="https://redis.io/docs/latest/commands/unwatch/">redis.io</a> for details.
* @return <code>OK</code>.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/** Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0 */
package glide.api.commands;

import java.util.concurrent.CompletableFuture;

/**
* Supports commands for the "Transactions Commands" group for standalone clients.
*
* @see <a href="https://redis.io/commands/?group=transactions">Transactions Commands</a>
*/
public interface TransactionsCommands {
/**
* Flushes all the previously watched keys for a transaction. Executing a transaction will
* automatically flush all previously watched keys.
*
* @see <a href="https://redis.io/docs/latest/commands/unwatch/">redis.io</a> for details.
* @return <code>OK</code>.
* @example
* <pre>{@code
* assert client.watch(new String[] {"sampleKey"}).get().equals("OK");
* assert client.unwatch().get().equals("OK"); // Flushes "sampleKey" from watched keys.
* }</pre>
*/
CompletableFuture<String> unwatch();
}

0 comments on commit dd8724b

Please sign in to comment.