Skip to content

Add support to get cluster replica node for a given key#1581

Merged
vmihailenco merged 1 commit intoredis:masterfrom
prathik:replica-cmd
Dec 16, 2020
Merged

Add support to get cluster replica node for a given key#1581
vmihailenco merged 1 commit intoredis:masterfrom
prathik:replica-cmd

Conversation

@prathik
Copy link

@prathik prathik commented Dec 16, 2020

As discussed on discord @vmihailenco this PR adds support to export commands that give the replica and master for a given key.

// 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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rename this to SlaveForKey since we already have ForEachSlave.

@vmihailenco
Copy link
Collaborator

Thanks!

@vmihailenco vmihailenco merged commit e9fef17 into redis:master Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants