mirror of https://github.com/ledisdb/ledisdb.git
add config rewrite command
This commit is contained in:
parent
c09c02c82b
commit
53f89f671b
|
@ -9,6 +9,7 @@ module.exports = [
|
||||||
"flushall",
|
"flushall",
|
||||||
"flushdb",
|
"flushdb",
|
||||||
"time",
|
"time",
|
||||||
|
"config",
|
||||||
|
|
||||||
"bget",
|
"bget",
|
||||||
"bdelete",
|
"bdelete",
|
||||||
|
|
|
@ -154,6 +154,7 @@ local commands = {
|
||||||
"flushall",
|
"flushall",
|
||||||
"flushdb",
|
"flushdb",
|
||||||
"time",
|
"time",
|
||||||
|
"config",
|
||||||
|
|
||||||
-- [[transaction]]
|
-- [[transaction]]
|
||||||
"begin",
|
"begin",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//This file was generated by .tools/generate_commands.py on Wed Oct 08 2014 13:52:31 +0800
|
//This file was generated by .tools/generate_commands.py on Wed Oct 08 2014 16:36:20 +0800
|
||||||
package main
|
package main
|
||||||
|
|
||||||
var helpCommands = [][]string{
|
var helpCommands = [][]string{
|
||||||
|
@ -16,6 +16,7 @@ var helpCommands = [][]string{
|
||||||
{"BTTL", "key", "Bitmap"},
|
{"BTTL", "key", "Bitmap"},
|
||||||
{"BXSCAN", "key [MATCH match] [COUNT count]", "Bitmap"},
|
{"BXSCAN", "key [MATCH match] [COUNT count]", "Bitmap"},
|
||||||
{"COMMIT", "-", "Transaction"},
|
{"COMMIT", "-", "Transaction"},
|
||||||
|
{"CONFIG REWRITE", "-", "Server"},
|
||||||
{"DECR", "key", "KV"},
|
{"DECR", "key", "KV"},
|
||||||
{"DECRBY", "key decrement", "KV"},
|
{"DECRBY", "key decrement", "KV"},
|
||||||
{"DEL", "key [key ...]", "KV"},
|
{"DEL", "key [key ...]", "KV"},
|
||||||
|
|
|
@ -634,5 +634,11 @@
|
||||||
"arguments" : "-",
|
"arguments" : "-",
|
||||||
"group": "Server",
|
"group": "Server",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"CONFIG REWRITE": {
|
||||||
|
"arguments" : "-",
|
||||||
|
"group": "Server",
|
||||||
|
"readonly": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ Table of Contents
|
||||||
- [FLUSHDB](#flushdb)
|
- [FLUSHDB](#flushdb)
|
||||||
- [INFO [section]](#info-section)
|
- [INFO [section]](#info-section)
|
||||||
- [TIME](#time)
|
- [TIME](#time)
|
||||||
|
- [CONFIG REWRITE](#config-rewrite)
|
||||||
- [Transaction](#transaction)
|
- [Transaction](#transaction)
|
||||||
- [BEGIN](#begin)
|
- [BEGIN](#begin)
|
||||||
- [ROLLBACK](#rollback)
|
- [ROLLBACK](#rollback)
|
||||||
|
@ -2579,6 +2580,16 @@ The TIME command returns the current server time as a two items lists: a Unix ti
|
||||||
|
|
||||||
array: two elements, one is unix time in seconds, the other is microseconds.
|
array: two elements, one is unix time in seconds, the other is microseconds.
|
||||||
|
|
||||||
|
### CONFIG REWRITE
|
||||||
|
|
||||||
|
Rewrites the config file the server was started with.
|
||||||
|
|
||||||
|
**Unlike Redis rewrite, it will discard all comments in origin config file.**
|
||||||
|
|
||||||
|
**Return value**
|
||||||
|
|
||||||
|
String: OK or error msg.
|
||||||
|
|
||||||
## Transaction
|
## Transaction
|
||||||
|
|
||||||
### BEGIN
|
### BEGIN
|
||||||
|
|
|
@ -111,6 +111,24 @@ func timeCommand(c *client) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func configCommand(c *client) error {
|
||||||
|
if len(c.args) < 1 {
|
||||||
|
return ErrCmdParams
|
||||||
|
}
|
||||||
|
|
||||||
|
switch strings.ToLower(hack.String(c.args[0])) {
|
||||||
|
case "rewrite":
|
||||||
|
if err := c.app.cfg.Rewrite(); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
c.resp.writeStatus(OK)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return ErrCmdParams
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
register("ping", pingCommand)
|
register("ping", pingCommand)
|
||||||
register("echo", echoCommand)
|
register("echo", echoCommand)
|
||||||
|
@ -119,4 +137,5 @@ func init() {
|
||||||
register("flushall", flushallCommand)
|
register("flushall", flushallCommand)
|
||||||
register("flushdb", flushdbCommand)
|
register("flushdb", flushdbCommand)
|
||||||
register("time", timeCommand)
|
register("time", timeCommand)
|
||||||
|
register("config", configCommand)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue