use of org.redisson.client.RedisClient in project redisson by redisson.
the class RedisClientTest method testBigRequest.
@Test
public void testBigRequest() throws InterruptedException, ExecutionException {
RedisClient c = new RedisClient(RedisRunner.getDefaultRedisServerBindAddressAndPort());
RedisConnection conn = c.connect();
for (int i = 0; i < 50; i++) {
conn.sync(StringCodec.INSTANCE, RedisCommands.HSET, "testmap", i, "2");
}
Map<Object, Object> res = conn.sync(StringCodec.INSTANCE, RedisCommands.HGETALL, "testmap");
assertThat(res.size()).isEqualTo(50);
conn.sync(RedisCommands.FLUSHDB);
}
use of org.redisson.client.RedisClient in project redisson by redisson.
the class RedisClientTest method testPipelineBigResponse.
@Test
public void testPipelineBigResponse() throws InterruptedException, ExecutionException {
RedisClient c = new RedisClient(RedisRunner.getDefaultRedisServerBindAddressAndPort());
RedisConnection conn = c.connect();
List<CommandData<?, ?>> commands = new ArrayList<CommandData<?, ?>>();
for (int i = 0; i < 1000; i++) {
CommandData<String, String> cmd1 = conn.create(null, RedisCommands.PING);
commands.add(cmd1);
}
RPromise<Void> p = new RedissonPromise<Void>();
conn.send(new CommandsData(p, commands));
for (CommandData<?, ?> commandData : commands) {
commandData.getPromise().get();
}
conn.sync(RedisCommands.FLUSHDB);
}
Aggregations