mirror of https://github.com/go-redis/redis.git
commands.go: Add ClusterKeySlot function.
This commit is contained in:
parent
8319126d93
commit
9b1148903e
|
@ -229,6 +229,11 @@ var _ = Describe("Cluster", func() {
|
||||||
Expect(res).To(ContainSubstring("cluster_known_nodes:6"))
|
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() {
|
Describe("Client", func() {
|
||||||
|
|
|
@ -1698,6 +1698,13 @@ func (c *commandable) ClusterInfo() *StringCmd {
|
||||||
return cmd
|
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 {
|
func (c *commandable) ClusterFailover() *StatusCmd {
|
||||||
cmd := newKeylessStatusCmd("CLUSTER", "failover")
|
cmd := newKeylessStatusCmd("CLUSTER", "failover")
|
||||||
c.Process(cmd)
|
c.Process(cmd)
|
||||||
|
|
Loading…
Reference in New Issue