Apply comments #27 and change default mode for custom command conf

This commit is contained in:
Yoon 2018-04-09 10:12:15 +09:00
parent 7812aa8c4f
commit 2d93868e82
3 changed files with 6 additions and 14 deletions

View File

@ -10,40 +10,35 @@ CustomCommand {
# Currently support only 1 key with first argument.
minArgs 3 # minimum arguments(including command itself), default is 2(key only)
maxArgs 3 # maximum arguments(including command itself), default is 2(key only)
mode Read,Write # behavior or permission. Currently support Read, Write, Admin
mode Read,Write # a command mode Read/Write/Admin is exclusive, Conf.cpp should check this.
# default is Read, Write
}
# hello.repl2 <list-key>
# just skipped since minArgs = 2, maxArgs = 2 are default values
# just skipped since minArgs = 2, maxArgs = 2, mode = Read,Write are default values
hello.repl2 {
mode Read,Write
}
# hello.toggle.case key
hello.toggle.case {
mode Read,Write
}
# hello.more.expire key milliseconds
hello.more.expire {
minArgs 3
maxArgs 3
mode Read,Write
}
# hello.zsumrange key startscore endscore
hello.zsumrange {
minArgs 4
maxArgs 4
mode Read,Write
}
# hello.lexrange key min_lex max_lex min_age max_age
hello.lexrange {
minArgs 6
maxArgs 6
mode Read,Write
}
# hello.hcopy key srcfield dstfield
hello.hcopy {
minArgs 4
maxArgs 4
mode Read,Write
}
# from redis source src/modules/hellotype.c
@ -51,16 +46,13 @@ CustomCommand {
hello.insert {
minArgs 3
maxArgs 3
mode Read,Write
}
# hellotype.range key first count
hellotype.range {
minArgs 4
maxArgs 4
mode Read,Write
}
# hellotype.len key
hello.len {
mode Read,Wrie
}
}

View File

@ -93,7 +93,7 @@ Include try.conf
# Include dc.conf
################################### LATENCY ####################################
################################### COMMAND ####################################
## Custom command define, see command.conf
## must be defined before Latency monitor
#Include command.conf

View File

@ -38,8 +38,8 @@ void CustomCommandConf::init(CustomCommandConf&c, const char* name, const int ty
c.cmd.type = (Command::Type)type;
c.cmd.name = c.name.c_str();
c.cmd.minArgs = 2;
c.cmd.maxArgs = 1;
c.cmd.mode = Command::Write;
c.cmd.maxArgs = 2;
c.cmd.mode = Command::Write|Command::Read;
}
Conf::Conf():