- jedis可以使用无参构造函数实例化:
1 | try (Jedis j = new Jedis()) { |
使用try语法说明jedis类实现了java的Closeable接口
- jedis也可以使用HostAndPort对象和JedisClientConfig配置对象实例化:
1 | try (Jedis jedis = new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared") |
1 | try (Jedis j = new Jedis()) { |
使用try语法说明jedis类实现了java的Closeable接口
1 | try (Jedis jedis = new Jedis(hnp, DefaultJedisClientConfig.builder().password("foobared") |