Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CLIENT NO-EVICT #2492

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ type Cmdable interface {
Command(ctx context.Context) *CommandsInfoCmd
CommandList(ctx context.Context, filter *FilterBy) *StringSliceCmd
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
Expand Down Expand Up @@ -562,6 +564,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)
Expand Down
10 changes: 10 additions & 0 deletions commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down