forked from joyieldInc/predixy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add config sample(including Read mode) - apply @fortue's suggestion to check exclusive mode and key postion
- Loading branch information
Showing
3 changed files
with
56 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,83 @@ | ||
# CustomCommand section must be defined before Latency monitor to support all commands | ||
# | ||
# NOTE: only support maximum 16 custom commands | ||
# | ||
# [...] must be specify | ||
# (...) optional. it has default value | ||
# | ||
# CustomCommand [alias1] { ## module alias. just a delimter | ||
# [command1] { ## command string, must be lower case. i.e. setnx, expire, ... | ||
# (minArgs) (val) ## minimum arguments(including command itself). default is 2(key only) | ||
# (maxArgs) (val) ## maximum arguments(including command itself). default is 2(key only) | ||
# (mode) (val) ## a command mode Read/Write/Admin is exclusive. default is Write. | ||
# } | ||
# [command2] { | ||
# ... | ||
# } | ||
# ... | ||
# } | ||
# | ||
# default key position is first parameter. i.e. command1 key ... | ||
# if you want to use other position, add KeyAt2(key is second) or KeyAt3(key is third) to mode with '|' | ||
# i.e. mode Write|KeyAt2 | ||
# | ||
# in case of 'mode KeyAt2', it will resolved as Write|KeyAt2 | ||
|
||
CustomCommand { | ||
# from redis source src/modules/hello.c | ||
# from redis source src/modules/hello.c | ||
CustomCommand hello { | ||
# hello.push.native key value | ||
hello.push.native { # name of command, must be lowercase. | ||
# key parameter is located at first argument. i.e. command key ... | ||
# 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 Write # a command mode Read/Write/Admin is exclusive, default is Write | ||
hello.push.native { | ||
minArgs 3 | ||
maxArgs 3 | ||
mode Write | ||
} | ||
# hello.repl2 <list-key> | ||
# just skipped since minArgs = 2, maxArgs = 2, mode = Write are default values | ||
hello.repl2 { | ||
} | ||
# hello.toggle.case key | ||
# same as hello.repl2 | ||
hello.toggle.case { | ||
mode Write | ||
} | ||
# hello.more.expire key milliseconds | ||
hello.more.expire { | ||
minArgs 3 | ||
maxArgs 3 | ||
mode Write | ||
} | ||
# hello.zsumrange key startscore endscore | ||
hello.zsumrange { | ||
minArgs 4 | ||
maxArgs 4 | ||
mode Write | ||
mode Read | ||
} | ||
# hello.lexrange key min_lex max_lex min_age max_age | ||
hello.lexrange { | ||
minArgs 6 | ||
maxArgs 6 | ||
mode Write | ||
mode Read | ||
} | ||
# hello.hcopy key srcfield dstfield | ||
hello.hcopy { | ||
minArgs 4 | ||
maxArgs 4 | ||
mode Write | ||
} | ||
} | ||
|
||
# from redis source src/modules/hellotype.c | ||
# from redis source src/modules/hellotype.c | ||
CustomCommand hellotype { | ||
# hellotype.insert key value | ||
hello.insert { | ||
hellotype.insert { | ||
minArgs 3 | ||
maxArgs 3 | ||
mode Write | ||
} | ||
# hellotype.range key first count | ||
hellotype.range { | ||
minArgs 4 | ||
maxArgs 4 | ||
mode Write | ||
mode Read | ||
} | ||
# hellotype.len key | ||
hello.len { | ||
mode Write | ||
mode Read | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters