Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2020

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