redisdemo

importredis.clients.jedis.*;

importjava.util.ArrayList;

importjava.util.List;


public classredisDemo {

public static voidmain(String [] args){

JedisPoolConfigconfig=newJedisPoolConfig();

config.setMaxTotal(50);

List list=newArrayList();

JedisShardInfojedisShardInfo1=newJedisShardInfo("10.211.55.5",6379);

list.add(jedisShardInfo1);

JedisShardInfojedisShardInfo2=newJedisShardInfo("10.211.55.5",6380);

list.add(jedisShardInfo2);

ShardedJedisPoolshardedJedisPool=newShardedJedisPool(config,list);

ShardedJedisjedis=shardedJedisPool.getResource();

for(inti=0;i<100;i++) {

jedis.set("test11"+String.valueOf(i),String.valueOf(i));

}

System.out.print(jedis.get("test1132"));

}

}

你可能感兴趣的:(redisdemo)