mirror of https://github.com/go-redis/redis.git
Add Client Unblock
This commit is contained in:
parent
11cf9400d5
commit
c6bf37c653
10
commands.go
10
commands.go
|
@ -2068,6 +2068,16 @@ func (c *cmdable) ClientID() *IntCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *cmdable) ClientUnblock(id int64, isError bool) *IntCmd {
|
||||||
|
args := []interface{}{"client", "unblock", id}
|
||||||
|
if isError {
|
||||||
|
args = append(args, "error")
|
||||||
|
}
|
||||||
|
cmd := NewIntCmd(args...)
|
||||||
|
c.process(cmd)
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
// ClientSetName assigns a name to the connection.
|
// ClientSetName assigns a name to the connection.
|
||||||
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
|
func (c *statefulCmdable) ClientSetName(name string) *BoolCmd {
|
||||||
cmd := NewBoolCmd("client", "setname", name)
|
cmd := NewBoolCmd("client", "setname", name)
|
||||||
|
|
|
@ -127,6 +127,13 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(client.ClientID().Val()).To(BeNumerically(">=", 0))
|
Expect(client.ClientID().Val()).To(BeNumerically(">=", 0))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should ClientUnblock", func() {
|
||||||
|
id := client.ClientID().Val()
|
||||||
|
r, err := client.ClientUnblock(id, true).Result()
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
Expect(r).To(Equal(int64(0)))
|
||||||
|
})
|
||||||
|
|
||||||
It("should ClientPause", func() {
|
It("should ClientPause", func() {
|
||||||
err := client.ClientPause(time.Second).Err()
|
err := client.ClientPause(time.Second).Err()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
Loading…
Reference in New Issue