use of io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands in project hazelcast-simulator by hazelcast.
the class StringStringSyncTest method loadInitialData.
// loading the data is very inefficient. Needs some work in the future
@Prepare(global = true)
public void loadInitialData() {
Random random = new Random();
StatefulRedisClusterConnection<String, String> connection = redisClient.connect();
RedisAdvancedClusterCommands sync = connection.sync();
// get rid of all data.
sync.flushall();
for (int k = 0; k < keyDomain; k++) {
int r = random.nextInt(valueCount);
sync.set(Long.toString(k), values[r]);
}
// connection.async().set()
}
use of io.lettuce.core.cluster.api.sync.RedisAdvancedClusterCommands in project lettuce-core by lettuce-io.
the class TopologyRefreshIntegrationTests method runReconnectTest.
private void runReconnectTest(BiFunction<RedisAdvancedClusterAsyncCommands<String, String>, RedisClusterNode, BaseRedisAsyncCommands> function) {
ClusterTopologyRefreshOptions topologyRefreshOptions = //
ClusterTopologyRefreshOptions.builder().refreshTriggersReconnectAttempts(//
0).enableAllAdaptiveRefreshTriggers().build();
clusterClient.setOptions(ClusterClientOptions.builder().topologyRefreshOptions(topologyRefreshOptions).build());
RedisAdvancedClusterAsyncCommands<String, String> clusterConnection = clusterClient.connect().async();
RedisClusterNode node = clusterClient.getPartitions().getPartition(0);
BaseRedisAsyncCommands closeable = function.apply(clusterConnection, node);
clusterClient.getPartitions().clear();
closeable.quit();
Wait.untilTrue(() -> {
return !clusterClient.getPartitions().isEmpty();
}).waitOrTimeout();
if (closeable instanceof RedisAdvancedClusterCommands) {
((RedisAdvancedClusterCommands) closeable).getStatefulConnection().close();
}
clusterConnection.getStatefulConnection().close();
}
Aggregations