From d0a2b8bdf3d0104a8d766370a6af5b7697d93f25 Mon Sep 17 00:00:00 2001 From: janaurka Date: Thu, 1 Mar 2018 09:37:51 +0100 Subject: [PATCH] Impement Config Rewrite command (#722) This commit adds support for config rewrite as documented in https://redis.io/commands/config-rewrite . --- commands.go | 7 +++++++ commands_test.go | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/commands.go b/commands.go index 45bb0aed..175cd851 100644 --- a/commands.go +++ b/commands.go @@ -198,6 +198,7 @@ type Cmdable interface { ConfigGet(parameter string) *SliceCmd ConfigResetStat() *StatusCmd ConfigSet(parameter, value string) *StatusCmd + ConfigRewrite() *StatusCmd DBSize() *IntCmd FlushAll() *StatusCmd FlushAllAsync() *StatusCmd @@ -1725,6 +1726,12 @@ func (c *cmdable) ConfigSet(parameter, value string) *StatusCmd { return cmd } +func (c *cmdable) ConfigRewrite() *StatusCmd { + cmd := NewStatusCmd("config", "rewrite") + c.process(cmd) + return cmd +} + // Deperecated. Use DBSize instead. func (c *cmdable) DbSize() *IntCmd { return c.DBSize() diff --git a/commands_test.go b/commands_test.go index 5750bdea..a4e5250d 100644 --- a/commands_test.go +++ b/commands_test.go @@ -162,6 +162,12 @@ var _ = Describe("Commands", func() { 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() { size, err := client.DBSize().Result() Expect(err).NotTo(HaveOccurred())