forked from mirror/redis
Rename
This commit is contained in:
parent
602b106abb
commit
143859e345
|
@ -1655,13 +1655,13 @@ func (c *ClusterClient) slotMasterNode(ctx context.Context, slot int) (*clusterN
|
||||||
return state.slotMasterNode(slot)
|
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
|
// This is especially useful if we want to run a particular lua script which has
|
||||||
// only read only commands on the replica.
|
// only read only commands on the replica.
|
||||||
// This is because other redis commands generally have a flag that points that
|
// This is because other redis commands generally have a flag that points that
|
||||||
// they are read only and automatically run on the replica nodes
|
// they are read only and automatically run on the replica nodes
|
||||||
// if ClusterOptions.ReadOnly flag is set to true.
|
// 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)
|
state, err := c.state.Get(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -865,7 +865,7 @@ var _ = Describe("ClusterClient", func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
It("should return correct replica for key", 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())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
info := client.Info(ctx, "server")
|
info := client.Info(ctx, "server")
|
||||||
Expect(info.Val()).Should(ContainSubstring("tcp_port:8224"))
|
Expect(info.Val()).Should(ContainSubstring("tcp_port:8224"))
|
||||||
|
|
Loading…
Reference in New Issue