diff --git a/cluster.go b/cluster.go index d2e78b28..3807265d 100644 --- a/cluster.go +++ b/cluster.go @@ -1655,13 +1655,13 @@ func (c *ClusterClient) slotMasterNode(ctx context.Context, slot int) (*clusterN return state.slotMasterNode(slot) } -// ReplicaForKey gets a client for a replica node to run any command on it. +// SlaveForKey gets a client for a replica node to run any command on it. // This is especially useful if we want to run a particular lua script which has // only read only commands on the replica. // This is because other redis commands generally have a flag that points that // they are read only and automatically run on the replica nodes // if ClusterOptions.ReadOnly flag is set to true. -func (c *ClusterClient) ReplicaForKey(ctx context.Context, key string) (*Client, error) { +func (c *ClusterClient) SlaveForKey(ctx context.Context, key string) (*Client, error) { state, err := c.state.Get(ctx) if err != nil { return nil, err diff --git a/cluster_test.go b/cluster_test.go index 79779985..64acecf6 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -865,7 +865,7 @@ var _ = Describe("ClusterClient", func() { }) It("should return correct replica for key", func() { - client, err := client.ReplicaForKey(ctx, "test") + client, err := client.SlaveForKey(ctx, "test") Expect(err).ToNot(HaveOccurred()) info := client.Info(ctx, "server") Expect(info.Val()).Should(ContainSubstring("tcp_port:8224"))