Skip to content

Commit

Permalink
commands.go: Add ClusterKeySlot function.
Browse files Browse the repository at this point in the history
  • Loading branch information
anmic committed Dec 28, 2015
1 parent 8319126 commit 9b11489
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ var _ = Describe("Cluster", func() {
Expect(res).To(ContainSubstring("cluster_known_nodes:6"))
})

It("should CLUSTER KEYSLOT", func() {
res, err := cluster.primary().ClusterKeySlot("somekey").Result()
Expect(err).NotTo(HaveOccurred())
Expect(res).To(Equal(int64(11058)))
})
})

Describe("Client", func() {
Expand Down
7 changes: 7 additions & 0 deletions commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -1698,6 +1698,13 @@ func (c *commandable) ClusterInfo() *StringCmd {
return cmd
}

func (c *commandable) ClusterKeySlot(key string) *IntCmd {
cmd := NewIntCmd("CLUSTER", "keyslot", key)
cmd._clusterKeyPos = 2
c.Process(cmd)
return cmd
}

func (c *commandable) ClusterFailover() *StatusCmd {
cmd := newKeylessStatusCmd("CLUSTER", "failover")
c.Process(cmd)
Expand Down

0 comments on commit 9b11489

Please sign in to comment.