Skip to content

Hash keys locally rather than call cluster keyslot #2159

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* @author Christoph Strobl
* @author Mark Paluch
* @author ihaohong
* @author Dan Smith
* @since 2.0
*/
class JedisClusterKeyCommands implements RedisKeyCommands {
Expand Down Expand Up @@ -512,7 +513,7 @@ public void restore(byte[] key, long ttlInMillis, byte[] serializedValue, boolea
return JedisConverters.toString(this.connection.execute("RESTORE", key,
Arrays.asList(JedisConverters.toBytes(ttlInMillis), serializedValue, JedisConverters.toBytes("REPLACE"))));

}, connection.clusterGetNodeForKey(key));
}, connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key));
}

/*
Expand Down Expand Up @@ -595,7 +596,7 @@ public ValueEncoding encodingOf(byte[] key) {

return connection.getClusterCommandExecutor()
.executeCommandOnSingleNode((JedisClusterCommandCallback<byte[]>) client -> client.objectEncoding(key),
connection.clusterGetNodeForKey(key))
connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
.mapValue(JedisConverters::toEncoding);
}

Expand All @@ -611,7 +612,7 @@ public Duration idletime(byte[] key) {

return connection.getClusterCommandExecutor()
.executeCommandOnSingleNode((JedisClusterCommandCallback<Long>) client -> client.objectIdletime(key),
connection.clusterGetNodeForKey(key))
connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
.mapValue(Converters::secondsToDuration);
}

Expand All @@ -627,7 +628,7 @@ public Long refcount(byte[] key) {

return connection.getClusterCommandExecutor()
.executeCommandOnSingleNode((JedisClusterCommandCallback<Long>) client -> client.objectRefcount(key),
connection.clusterGetNodeForKey(key))
connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
.getValue();

}
Expand Down