From 0876284c07dd16bb4b8f5fbf0c80e36453719105 Mon Sep 17 00:00:00 2001 From: Anuragkillswitch <70265851+Anuragkillswitch@users.noreply.github.com> Date: Sun, 19 Mar 2023 15:58:57 +0530 Subject: [PATCH] feat: Adding support for Client No-Evict --- commands.go | 14 ++++++++++++++ commands_test.go | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/commands.go b/commands.go index ac93f39c9..0c033303a 100644 --- a/commands.go +++ b/commands.go @@ -125,6 +125,8 @@ type Cmdable interface { Command(ctx context.Context) *CommandsInfoCmd ClientGetName(ctx context.Context) *StringCmd + ClientNoEvictOn(ctx context.Context) *StatusCmd + ClientNoEvictOff(ctx context.Context) *StatusCmd Echo(ctx context.Context, message interface{}) *StringCmd Ping(ctx context.Context) *StatusCmd Quit(ctx context.Context) *StatusCmd @@ -544,6 +546,18 @@ func (c cmdable) ClientGetName(ctx context.Context) *StringCmd { return cmd } +func (c cmdable) ClientNoEvictOn(ctx context.Context) *StatusCmd { + cmd := NewStatusCmd(ctx, "client", "no-evict","on") + _ = c(ctx, cmd) + return cmd +} + +func (c cmdable) ClientNoEvictOff(ctx context.Context) *StatusCmd { + cmd := NewStatusCmd(ctx, "client", "no-evict","off") + _ = c(ctx, cmd) + return cmd +} + func (c cmdable) Echo(ctx context.Context, message interface{}) *StringCmd { cmd := NewStringCmd(ctx, "echo", message) _ = c(ctx, cmd) diff --git a/commands_test.go b/commands_test.go index f806dc8f5..a0d6aaed0 100644 --- a/commands_test.go +++ b/commands_test.go @@ -188,6 +188,16 @@ var _ = Describe("Commands", func() { Expect(get.Val()).To(Equal("theclientname")) }) + It("should ClientNoEvict", func() { + result := client.ClientNoEvictOff(ctx) + Expect(result.Err()).NotTo(HaveOccurred()) + Expect(result.Val()).To(Equal("OK")) + + result = client.ClientNoEvictOn(ctx) + Expect(result.Err()).NotTo(HaveOccurred()) + Expect(result.Val()).To(Equal("OK")) + }) + It("should ConfigGet", func() { val, err := client.ConfigGet(ctx, "*").Result() Expect(err).NotTo(HaveOccurred())