Impement Config Rewrite command (#722)

This commit adds support for config rewrite as documented in
https://redis.io/commands/config-rewrite .
This commit is contained in:
janaurka 2018-03-01 09:37:51 +01:00 committed by Vladimir Mihailenco
parent 55c9929dba
commit d0a2b8bdf3
2 changed files with 13 additions and 0 deletions

View File

@ -198,6 +198,7 @@ type Cmdable interface {
ConfigGet(parameter string) *SliceCmd ConfigGet(parameter string) *SliceCmd
ConfigResetStat() *StatusCmd ConfigResetStat() *StatusCmd
ConfigSet(parameter, value string) *StatusCmd ConfigSet(parameter, value string) *StatusCmd
ConfigRewrite() *StatusCmd
DBSize() *IntCmd DBSize() *IntCmd
FlushAll() *StatusCmd FlushAll() *StatusCmd
FlushAllAsync() *StatusCmd FlushAllAsync() *StatusCmd
@ -1725,6 +1726,12 @@ func (c *cmdable) ConfigSet(parameter, value string) *StatusCmd {
return cmd return cmd
} }
func (c *cmdable) ConfigRewrite() *StatusCmd {
cmd := NewStatusCmd("config", "rewrite")
c.process(cmd)
return cmd
}
// Deperecated. Use DBSize instead. // Deperecated. Use DBSize instead.
func (c *cmdable) DbSize() *IntCmd { func (c *cmdable) DbSize() *IntCmd {
return c.DBSize() return c.DBSize()

View File

@ -162,6 +162,12 @@ var _ = Describe("Commands", func() {
Expect(configSet.Val()).To(Equal("OK")) Expect(configSet.Val()).To(Equal("OK"))
}) })
It("should ConfigRewrite", func() {
configRewrite := client.ConfigRewrite()
Expect(configRewrite.Err()).NotTo(HaveOccurred())
Expect(configRewrite.Val()).To(Equal("OK"))
})
It("should DBSize", func() { It("should DBSize", func() {
size, err := client.DBSize().Result() size, err := client.DBSize().Result()
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())