From 9b1148903efb856265efb32d3a562d21c06d928b Mon Sep 17 00:00:00 2001
From: Anatolii Mihailenco <anmic.webdev@gmail.com>
Date: Mon, 28 Dec 2015 18:58:04 +0200
Subject: [PATCH] commands.go: Add ClusterKeySlot function.

---
 cluster_test.go | 5 +++++
 commands.go     | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/cluster_test.go b/cluster_test.go
index d409dcb..a585ad7 100644
--- a/cluster_test.go
+++ b/cluster_test.go
@@ -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() {
diff --git a/commands.go b/commands.go
index 231d472..ef615b0 100644
--- a/commands.go
+++ b/commands.go
@@ -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)