Redis Jedsi使用方法

JedisPoolConfig:用于配置Jedis连接池的配置

JedisPool:使用连接池获取Jedis连接

Jedis:实际与Redis进行一系列的操作

 

代码示例:

 1 public void demo(){
 2     JedisPoolConfig JPC=new JedisPoolConfig();
 3     JPC.setXXX();
 4     JedisPool JP=new JedisPool(JPC,"ip addr",port);  
 5     Jedis jedis=JP.getResource();
 6     jedis.set("key","value");
 7     String name=jedis.get("key");
 8     System.out.println(name);
 9     jedis.close();
10     JP.close();
11 }

 

posted @ 2017-11-08 23:06  星小梦  阅读(434)  评论(0编辑  收藏  举报