Skip to content

Commit

Permalink
Custom Command: Include reference link to the Wiki section detailing …
Browse files Browse the repository at this point in the history
…limitations and restrictions. (valkey-io#1343)
  • Loading branch information
barshaul authored and cyip10 committed Jun 24, 2024
1 parent cedcad5 commit 6ab6191
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ public interface GenericClusterCommands {
*
* <p>The command will be routed to all primaries.
*
* @remarks This function should only be used for single-response commands. Commands that don't
* return response (such as <em>SUBSCRIBE</em>), or that return potentially more than a single
* response (such as <em>XREAD</em>), or that change the client's behavior (such as entering
* <em>pub</em>/<em>sub</em> mode on <em>RESP2</em> connections) shouldn't be called using
* this function.
* @apiNote See <a
* href="https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command">Glide
* for Redis Wiki</a> for details on the restrictions and limitations of the custom command
* API.
* @param args Arguments for the custom command including the command name.
* @return Response from Redis containing an <code>Object</code>.
* @example
Expand All @@ -42,11 +41,10 @@ public interface GenericClusterCommands {
*
* <p>Client will route the command to the nodes defined by <code>route</code>.
*
* @remarks This function should only be used for single-response commands. Commands that don't
* return response (such as <em>SUBSCRIBE</em>), or that return potentially more than a single
* response (such as <em>XREAD</em>), or that change the client's behavior (such as entering
* <em>pub</em>/<em>sub</em> mode on <em>RESP2</em> connections) shouldn't be called using
* this function.
* @apiNote See <a
* href="https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command">Glide
* for Redis Wiki</a> for details on the restrictions and limitations of the custom command
* API.
* @param args Arguments for the custom command including the command name
* @param route Specifies the routing configuration for the command. The client will route the
* command to the nodes defined by <code>route</code>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ public interface GenericCommands {
* Executes a single command, without checking inputs. Every part of the command, including
* subcommands, should be added as a separate value in <code>args</code>.
*
* @apiNote See <a
* href="https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command">Glide
* for Redis Wiki</a> for details on the restrictions and limitations of the custom command
* API.
* @param args Arguments for the custom command.
* @return Response from Redis containing an <code>Object</code>.
* @remarks This function should only be used for single-response commands. Commands that don't
* return response (such as <em>SUBSCRIBE</em>), or that return potentially more than a single
* response (such as <em>XREAD</em>), or that change the client's behavior (such as entering
* <em>pub</em>/<em>sub</em> mode on <em>RESP2</em> connections) shouldn't be called using
* this function.
* @example
* <pre>{@code
* Object response = (String) client.customCommand(new String[] {"ping", "GLIDE"}).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,12 @@ public abstract class BaseTransaction<T extends BaseTransaction<T>> {
* Executes a single command, without checking inputs. Every part of the command, including
* subcommands, should be added as a separate value in args.
*
* @apiNote See <a
* href="https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command">Glide
* for Redis Wiki</a> for details on the restrictions and limitations of the custom command
* API.
* @param args Arguments for the custom command.
* @return A response from Redis with an <code>Object</code>.
* @remarks This function should only be used for single-response commands. Commands that don't
* return response (such as <em>SUBSCRIBE</em>), or that return potentially more than a single
* response (such as <em>XREAD</em>), or that change the client's behavior (such as entering
* <em>pub</em>/<em>sub</em> mode on <em>RESP2</em> connections) shouldn't be called using
* this function.
* @example Returns a list of all pub/sub clients:
* <pre>{@code
* Object result = client.customCommand(new String[]{ "CLIENT", "LIST", "TYPE", "PUBSUB" }).get();
Expand Down
3 changes: 2 additions & 1 deletion node/src/RedisClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export class RedisClient extends BaseClient {
/** Executes a single command, without checking inputs. Every part of the command, including subcommands,
* should be added as a separate value in args.
*
* @remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
* See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
* for details on the restrictions and limitations of the custom command API.
*
* @example
* ```typescript
Expand Down
3 changes: 2 additions & 1 deletion node/src/RedisClusterClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ export class RedisClusterClient extends BaseClient {
* The command will be routed automatically based on the passed command's default request policy, unless `route` is provided,
* in which case the client will route the command to the nodes defined by `route`.
*
* @remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
* See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
* for details on the restrictions and limitations of the custom command API.
*
* @example
* ```typescript
Expand Down
3 changes: 2 additions & 1 deletion node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,8 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
/** Executes a single command, without checking inputs. Every part of the command, including subcommands,
* should be added as a separate value in args.
*
* @remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
* See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
* for details on the restrictions and limitations of the custom command API.
*
* Command Response - A response from Redis with an `Object`.
*/
Expand Down
4 changes: 3 additions & 1 deletion python/python/glide/async_commands/cluster_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ async def custom_command(
) -> TResult:
"""
Executes a single command, without checking inputs.
@remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
for details on the restrictions and limitations of the custom command API.
@example - Return a list of all pub/sub clients from all nodes:
connection.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"], AllNodes())
Expand Down
4 changes: 3 additions & 1 deletion python/python/glide/async_commands/standalone_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class StandaloneCommands(CoreCommands):
async def custom_command(self, command_args: List[str]) -> TResult:
"""
Executes a single command, without checking inputs.
@remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
for details on the restrictions and limitations of the custom command API.
@example - Return a list of all pub/sub clients:
connection.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"])
Expand Down
4 changes: 3 additions & 1 deletion python/python/glide/async_commands/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def rename(self: TTransaction, key: str, new_key: str) -> TTransaction:
def custom_command(self: TTransaction, command_args: List[str]) -> TTransaction:
"""
Executes a single command, without checking inputs.
@remarks - This function should only be used for single-response commands. Commands that don't return response (such as SUBSCRIBE), or that return potentially more than a single response (such as XREAD), or that change the client's behavior (such as entering pub/sub mode on RESP2 connections) shouldn't be called using this function.
See the [Glide for Redis Wiki](https://github.com/aws/glide-for-redis/wiki/General-Concepts#custom-command)
for details on the restrictions and limitations of the custom command API.
@example - Append a command to list of all pub/sub clients:
transaction.customCommand(["CLIENT", "LIST","TYPE", "PUBSUB"])
Expand Down

0 comments on commit 6ab6191

Please sign in to comment.