mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Add documentation for firstkey
, lastkey
and keystep
parameters of RedisModule_CreateCommand
(#8883)
These parameters of RedisModule_CreateCommand were previously undocumented but they are needed for ACL to check permission on keys and by Redis Cluster to figure our how to route the command. Co-authored-by: Eduardo Felipe Castegnaro <edufelipe@onsign.tv> Co-authored-by: Oran Agra <oran@redislabs.com>
This commit is contained in:
parent
e5a8928290
commit
25d827d949
17
src/module.c
17
src/module.c
@ -818,7 +818,7 @@ int64_t commandFlagsFromString(char *s) {
|
||||
}
|
||||
|
||||
/* Register a new command in the Redis server, that will be handled by
|
||||
* calling the function pointer 'func' using the RedisModule calling
|
||||
* calling the function pointer 'cmdfunc' using the RedisModule calling
|
||||
* convention. The function returns REDISMODULE_ERR if the specified command
|
||||
* name is already busy or a set of invalid flags were passed, otherwise
|
||||
* REDISMODULE_OK is returned and the new command is registered.
|
||||
@ -876,6 +876,21 @@ int64_t commandFlagsFromString(char *s) {
|
||||
* to authenticate a client.
|
||||
* * **"may-replicate"**: This command may generate replication traffic, even
|
||||
* though it's not a write command.
|
||||
*
|
||||
* The last three parameters specify which arguments of the new command are
|
||||
* Redis keys. See https://redis.io/commands/command for more information.
|
||||
*
|
||||
* * 'firstkey': One-based index of the first argument that's a key.
|
||||
* Position 0 is always the command name itself.
|
||||
* 0 for commands with no keys.
|
||||
* * 'lastkey': One-based index of the last argument that's a key.
|
||||
* Negative numbers refer to counting backwards from the last
|
||||
* argument (-1 means the last argument provided)
|
||||
* 0 for commands with no keys.
|
||||
* * 'keystep': Step between first and last key indexes.
|
||||
* 0 for commands with no keys.
|
||||
*
|
||||
* This information is used by ACL, Cluster and the 'COMMAND' command.
|
||||
*/
|
||||
int RM_CreateCommand(RedisModuleCtx *ctx, const char *name, RedisModuleCmdFunc cmdfunc, const char *strflags, int firstkey, int lastkey, int keystep) {
|
||||
int64_t flags = strflags ? commandFlagsFromString((char*)strflags) : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user