Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Dec 16, 2020
1 parent 602b106 commit 143859e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 143859e

Please sign in to comment.